How 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?
Enter your recipe's description here.
include_once "$FarmD/cookbook/formextensions.php";
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.)
This 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.
See discussion at FormExtensions-Talk
User 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.