Re: [fw-general] default value not taken into account when validating a form

2010-08-10 Thread Guillaume ORIOL
Thank you for explaining how Zend_Form is supposed to work. I do better understand the meaning of "default value" in this context, but... ...the context where I use it is slightly different than a plain old HTML form. Let me explain. The posted data come from an XHR sent by a dojox.data.JsonRe

Re: [fw-general] default value not taken into account when validating a form

2010-08-10 Thread Hector Virgen
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

Re: [fw-general] default value not taken into account when validating a form

2010-08-10 Thread Guillaume ORIOL
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-

Re: [fw-general] default value not taken into account when validating a form

2010-08-10 Thread Hector Virgen
Is it a hidden input? Try this to see if it helps: $form->getElement('nature')->setValue('consignment'); -- Hector Virgen Sent on my Droid X On Aug 10, 2010 3:38 PM, "Guillaume ORIOL" wrote: The "nature" element is not filled in by the user. And the setDefault() is called after the element has

Re: [fw-general] default value not taken into account when validating a form

2010-08-10 Thread Guillaume ORIOL
The "nature" element is not filled in by the user. And the setDefault() is called after the element has been added to the form (as this element is added in the init() method of the form class). Le 11/08/10 00:30, Hector Virgen a écrit : When you view the form on the page, is the "nature" eleme

Re: [fw-general] default value not taken into account when validating a form

2010-08-10 Thread Hector Virgen
When you view the form on the page, is the "nature" element's value filled in? Are you calling setDefault() before or after adding the element to the form? -- Hector Virgen Sent on my Droid X On Aug 10, 2010 3:17 PM, "Guillaume ORIOL" wrote: Hi, I simply don't understand why I can set a defaul

[fw-general] default value not taken into account when validating a form

2010-08-10 Thread Guillaume ORIOL
Hi, I simply don't understand why I can set a default value on a form element if this default value is not taken into account when validating the form??? Here is my controller code: $form = new My_Form(); // The form defines a element named 'nature' that is REQUIRED $form->setDefault('nature