I have a set of radio buttons that is in between other controls that are part of an HTML form. I do not want the value of these radio buttons to be submitted with the query (I am just using these radio buttons for JavaScript stuff). Normally, I can do this with other controls (i.e. checkboxes, etc.) by not having a "name" attribute for them, and they won't get submitted. However, the "name" attribute is required in order for radio buttons to have their "mutually-exclusive" behavior. I cannot move the radio buttons outside of the form either, because it's situated in between other controls that do need to be submitted with the form. Also, I cannot disable the radio buttons because I need the user to be able to click them. So is there a way I can make a set of radio buttons that do not get submitted with the form?
views:
35answers:
3
+2
A:
Elements in an
I can think of a couple solutions:
Elements in an <iframe />
One would be to place the buttons within an iframe, within your form, and merely turn the border of the iframe off so as to give the impression they are in the form.
Remove during "Submit"
Another solution would be to remove the element from the form via Javascript on the forms submit action, sending a truncated list of elements back to the server.
If it were me, I'd just ignore the elements on the server-side.
Jonathan Sampson
2010-08-23 20:58:16
A:
You have a few options on this one.
- Consider UI methods to "rearrange" the form. For example, you could "place" the radio buttons in the visual form area without actually having the code in the form via use of CSS.
- Remove the element as others have said.
- Try an alternative form of input element such as the JqueryUI buttonset http://www.filamentgroup.com/lab/styling_buttons_and_toolbars_with_the_jquery_ui_css_framework/ Note, not tested without name element, but conceivably should work.
bpeterson76
2010-08-23 21:20:22
A:
If you didn't care about validity, you could still have the radio buttons, and not give them names. Your JS can identify them by their IDs, and without names, they won't pass any parameters.
McTrafik
2010-08-23 22:43:12