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" <go.li...@technema.fr> wrote:

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', 'consignment');
...
// Content of the $_POST:
// array(
//    'foo' => 1,
//    'bar' => 2
// )
// NO 'nature' value is posted by the HTML form

if ($request->isPost()) {
   if ($form->isValid($_POST)) {
       // never reached as isValid() fails on 'nature'
   }
}

Any explanation?
-- 
Guillaume ORIOL
Software engineer
Technema

Reply via email to