Monday, January 17, 2011

Check Box IDs not unique

Hi,

The snippet of code below is taken from The Cookbook.

http://book.cakephp.org/view/1395/options-multiple

echo $this->Form->input('Model.field', array(
'type' => 'select',
'multiple' => 'checkbox',
'options' => array(
'Value 1' => 'Label 1',
'Value 2' => 'Label 2'
)
));

The problem is the output is not what is expected. Rather then
getting:

<div class="input select">
<label for="ModelField">Field</label>
<input name="data[Model][field]" value="" id="ModelField"
type="hidden">
<div class="checkbox">
<input name="data[Model][field][]" value="Value 1"
id="ModelField1" type="checkbox">
<label for="ModelField1">Label 1</label>
</div>
<div class="checkbox">
<input name="data[Model][field][]" value="Value 2"
id="ModelField2" type="checkbox">
<label for="ModelField2">Label 2</label>
</div>
</div>

I instead get:

<div class="input select">
<label for="ModelField">Field</label>
<input type="hidden" id="ModelField" value="" name="data[Model]
[field]">
<div class="checkbox">
<input type="checkbox" id="ModelFieldLu" value="Value 1"
name="data[Model][field][]">
<label for="ModelFieldLu">Label 1</label>
</div>
<div class="checkbox">
<input type="checkbox" id="ModelFieldLu" value="Value 2"
name="data[Model][field][]">
<label for="ModelFieldLu">Label 2</label>
</div>
</div>

The IDs for each Input are not unique. Is this a bug or am I doing
something wrong?


Cheers.

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate