|
Cookbook /
FormExtensionsSummary: adds fieldset, legend, and label tags to PmWiki forms
Version: 1.0
Prerequisites:
Status: in active use at essentialclarity.com, territoryteller.org
Maintainer: Ben Stallings
Categories: Forms
Questions answered by this recipeHow can I use PmWiki to generate XHTML's <fieldset>, <legend>, and <label> tags in my forms? How can I easily add a button to a page that causes all checkboxes on that page to toggle to the opposite state? DescriptionEnter your recipe's description here.
Since a legend is only ever used in conjunction with a fieldset, it has been moved inside the fieldset tag, to eliminate the need for a separate (:legend:) tag. Similarly, the text of a label has been moved into the label tag to eliminate the need for a separate (:labelend:) tag. However, note that an input must have an id that matches the label. (:input form:) (:fieldset "What is your favorite primary color?":) (:input radio color red id=red:) (:label red "Red like the sunset":)\\ (:input radio color green id=green:) (:label green "Green like the grass":)\\ (:input radio color blue id=blue:) (:label blue "Blue like the ocean":) (:fieldsetend:) (:input submit:) (:input end:) The example code above will result in the three radio buttons being surrounded by a box with "What is your favorite primary color" at the top. The text beside each radio button will be clickable to activate the corresponding button. See a working example at http://www.essentialclarity.com/Coaching/SignUp . (Please don't submit the form unless you really want what it's offering.) NotesThis recipe is called "Form Extensions" because I plan to add additional features soon. Here's my current wish list; feel free to add features you'd like to see.
Release Notes
Comments
The difference is that if you click plain text, the checkbox doesn't change, but if you click a label, the checkbox (or radio button) changes just as if you had clicked it directly. It makes the form easier and faster to fill out. Ben Stallings Oh I see now. But it is hard to see intuitively. Adding to pub/css/local.css the following will show a hand pointer when hovering over the lables: label:hover { cursor:pointer; cursor:hand; }
See Also
ContributorsUser notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |