04-22-2012, 04:52 AM
I know this is not a forum for html, but I am developing a script that processes form post vars that contain select/option elements with optgroup tag sets.
Do browsers sent this value, or any indication with the selected value(s)?
If so, how and what should be looked for by processing script?
Could I add a name attribute to the optgroup opening tag?
(texts I have to hand do not say anything about this)
Thanks for time and attention
04-22-2012, 05:06 AM
optgroups cannot be selected - they are simply a way of grouping the options.
Only the select itself can have a name and the options supply the values.
If you want to identify which optgroup the option was in then you will need to set the option values so they identify the group as well as the individual option.
04-22-2012, 05:45 AM
These suggestions will work. But it seems to me, though I do not remember specifically how or where, I did a select/option element with nested select/options
04-24-2012, 11:55 AM
There is jquery plugins to emulate that type of behaviour, but if I were to create a simple one I'd just create the categories with the html:
<option value = "">--Category</option>
<option value = ""> --Sub Category</option>
It's not perfect but it's quick, easy and gives the same illusion as optgroups that are selectable.