Based on the ideas of Zen Coding, I built this plugin on a similar syntax. The strings used to generate the form elements are broken into three sections. First if the field is to be required, then the string should start with an asterisk. This will wrap the element with a div tag and given a css class called “inputReq” so that it can later be styled in your CSS rules.
Next the second field in the syntax is where you would enter the name of the field. This value will be used as a label for the field and then converted to lowercase and spaces substituted for underscores in the id and name attribute for the field. Now if you are making a text, password or textarea field, your done. But if you want to create groups like radio buttons and checkboxes or select menus, you now would enter those individual values in this same area but in brackets separated by a pipe – “|”.
Last you would enter the type of field. Currently the plugin supports the most common used – text, password, hidden, textarea, radio, checkbox, and select.
Check out the table below for a another break down of the syntax.
| Required | , | Name[sub categories] | , | Type |
|---|---|---|---|---|
| Enter “*” or “” | , | {Field Title[sub_cat1|subcat2|subcat3]} | , | {Field Type} |
Here is another look at the how this works:
*,First Name,text ,Phone,text *,Password,password ,Gender[Male|Female],radio ,Comments,textarea
After the plugin is run, you would have:
First Name*
Phone
Password*
Gender
Male
Female
Comments
Get the Plugin Here
Also I have some styles to go along with the mark-up that is generated. To add to Coda Clips click here