originally, when I had the values array set to; array_vals=array('0' =>
'Inactive', '1=>'Active');
I had the default val set to 1 and if 'Inactive' was chosen, and then form
was invalid, when the from was rerendered, the value of that field was
always set to 'Active' (1).Viewing the posted values, the testfield value was showing as '0', but it never took. soon as i changed the order, everything worked. So does the numberical order of the keys in the array make a difference? Micah Gersten wrote: > > In a select dropdown, the default if none is specified is the first > option regardless of value. > > Thank you, > Micah Gersten > onShore Networks > Internal Developer > http://www.onshore.com > > > > maxarbos wrote: >> For a weird reason, I tried rearranging the order of the array of options >> from >> >> array_vals=array('1' => 'Active', '0'=>'Inactive'); >> >> TO: >> array_vals=array('0' => 'Inactive', '1=>'Active'); >> >> and added the default value to the element instance and it works fine. >> >> I wanted to make the 'Active' option show first, that's why i was listing >> it >> first. >> So I guess the order of the values array options is important on 0/1 >> values. >> >> >> >> >> >> maxarbos wrote: >> >>> I have a form that has a select field with two values: 1 and 0. >>> >>> <select name="testfield"> >>> <option value="1">Yes</option> >>> <option value="0">No</option> >>> </select> >>> >>> When I submit the form and it is invalid, this select box does not >>> remember the value of this field. It always defaults to '1'. There is no >>> default value listed in the form builder file. >>> >>> All other fields of the form, including the other select fields retain >>> their values when there is no '0' value choosen. >>> >>> Any advice would be great. >>> >>> Thanks. >>> >>> >>> >> >> > > -- View this message in context: http://www.nabble.com/Zend_Form-retain-select-value%3D%220%22-on-invalid-submission-tp18712028p18717435.html Sent from the Zend Framework mailing list archive at Nabble.com.
