Adding a Radio Button Group


Adding a Radio Button Group

Radio buttons don't exist by themselvesthey always come in a group. And of that group, only one option can be chosen : your visitors can pick rock or paper or scissors.

To add a radio button group:

1.
Choose where in your form you want your radio button group to appear, and click the radio group button on the Insert Bar.

2.
The Radio Group dialog will appear ( Figure 10.14 ), asking you to enter several fields:

  • Name : A radio group needs a name that associates all of the radio buttons together. In this example, your visitor is choosing whether or not to subscribe to a newsletter, so the name is "newsletter."

  • Radio button label: Each radio button needs a label to distinguish it from its neighbors. In this example, the labels are "Yes" and "No."

  • Radio button value: Each radio button needs a value, which will be passed back to the server CGI and/or JavaScript. The values here are, again, "Yes" and "No."

  • Lay out using: Radio buttons are normally aligned vertically, so here you make your choice of how you want that layout to be done in the HTML markup. Your choices are "Line breaks" and "Table." Line breaks will almost always be sufficient.

    Figure 10.14. The Radio Group dialog lets you enter all of your radio buttons in a single dialog.

    The Radio Group dialog starts with two fields, which you can overwrite to say whatever you want. If you want to add more radio buttons, click the + on the left side. If you want to delete buttons, in the list, select the one you want to remove, and click on the - .

    To rearrange the order of buttons, in the list, select the name of the button to move, and then click the up/down arrows to move that button.

3.
Click OK to accept your entries, and your new radio button group will be added to your document ( Figure 10.15 ).

Figure 10.15. Here's your radio group. Only one item can be clicked.


Tips

  • If you want your buttons to all be on the same line (as in this example), select "Lay out using Line Breaks," and then remove the line breaks. Sadly, Dreamweaver doesn't include an option of "just leave them on the same line, okay?"

  • There's also an option on the Insert Bar to add a single radio button: . It's unlikely , though, that you'll ever want to have only a single radio button on a page. If you add a single radio button to an existing radio group, be sure to copy the name of the group exactly into the Property Inspector ( Figure 10.16 ). In fact, your best bet is to click one of the existing radio buttons, copy the name from the Property Inspector, click the new radio button (if it already exists; add it if it doesn't), and then paste the name in from the clipboard.

    Figure 10.16. When setting the properties for an individual radio button, be careful in setting the name of the groupit has to match other radio buttons to work correctly.

  • If you want one of your radio buttons to be set as checked, click on that button in your document, and then change the Initial state in the Property Inspector from Unchecked to Checked.

  • Dreamweaver will happily let you set multiple radio buttons with their initial state checked even though browsers won't display it that way. Be careful that you're only setting zero or one radio button to be checked.





Macromedia Dreamweaver 8 for Windows & Macintosh Visual QuickStart Guide
Macromedia Dreamweaver 8 for Windows & Macintosh
ISBN: 0321350278
EAN: 2147483647
Year: 2005
Pages: 239

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net