I'm working on a form creation tool, the Select field contains a section where you can create new options and mark one as default.
Here is an example: http://screencast.com/t/AvyVqh3pv
My array of saved attributes looks like this right now:
1 =>
array (size=5)
'title' => string 'Title' (length=5)
'type' => string 'select' (length=6)
'required' => string '0' (length=1)
'options' =>
array (size=7)
0 => string '1' (length=1)
1 => string '4' (length=1)
3 => string '6' (length=1)
4 => string '7' (length=1)
5 => string '8' (length=1)
6 => string '9' (length=1)
7 => string '10' (length=2)
'default_option' => string '10' (length=1)
I'm using jQuery to change the radio button value when respective text input value is changed. This works fine but I'd like to have this feature working even if javascript is not enabled.
I'm working with the WordPress Settings API so my options are limited here I guess, this is the HTML used for each one of the Text Input + Radio Button rows:
<div class="fusion_booking_form_field_option_holder">
<input type="radio" name="fusion_booking_form_field[1][default_option]" value="1">
<input option_id="0" type="text" name="fusion_booking_form_field[1][options][0]" class="fub_form_field_options" value="1">
<div class="fub_form_field_options_remove">Remove Option</div>
</div>
<div class="fusion_booking_form_field_option_holder">
<input type="radio" name="fusion_booking_form_field[2][default_option]" value="1">
<input option_id="1" type="text" name="fusion_booking_form_field[2][options][0]" class="fub_form_field_options" value="2">
<div class="fub_form_field_options_remove">Remove Option</div>
</div>
Any ideas on how I can save the selected default option in a way that I can easily check it when the page is reloaded is appreciated.