On Tue, Mar 17, 2009 at 10:35 PM, Aurelius <[email protected]> wrote:
>
> Why doesn't that work:
> echo $form->input('Validate.s_address', array( 'type' => 'checkbox',
> 'label' => __("Other address",true), 'id' => 's_address', 'value' =>
> 1));
>
> It generates:
> <div class="input checkbox">
>  <input type="hidden" name="data[Validate][s_address]"
> id="s_address_" value="0" />
>  <input type="checkbox" name="data[Validate][s_address]"
> id="s_address" value="1" />
>  <label for="s_address">Other address</label>
> </div>
>
> But It should generate only one inputfield!

Note that one of them is hidden and its name begins with an
underscore. That element is created so that FormHelper can decide how
to set the checkbox value if you submit and for some reason (eg.
validation fails) and your form is re-displayed. FormHelper needs to
know what the default value was.

Or something like that.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to