I'm not sure if that's how the "default" value is supposed to work. AFAIK, it sets the default value for the form element when the page is loaded. The user can then overwrite this value by editing the field. If the user empties the field, then I consider that a deliberate attempt to submit an empty string for that field.
Btw, why doesn't that element appear in the post data? -- Hector Virgen Sent on my Droid X On Aug 10, 2010 3:50 PM, "Guillaume ORIOL" <[email protected]> wrote: No, this is not a hidden field. I already tried your suggestion with setValue() but it doesn't help. I was able to trace my problem down to the Zend_Form::isValid() method. For each element, this code block is executed: if (!isset($check[$key])) { $valid = $element->isValid(null, $context) && $valid; } else { $valid = $element->isValid($check[$key], $context) && $valid; $data = $this->_dissolveArrayUnsetKey($data, $belongsTo, $key); } As you can see, the element is not validated against its (default) value when the value doesn't exist in the posted data. Le 11/08/10 00:42, Hector Virgen a écrit : > > > > Is it a hidden input? Try this to see if it helps: > > > > $form->getElement('nature')->setValue('co... > >> >> On Aug 10, 2010 3:38 PM, "Guillaume ORIOL" <[email protected]<mailto: >> [email protected]>> w... >> <mailto:[email protected]> <mailto:[email protected] <mailto: >> [email protected]>>> w... >> >>
