문제

I assume it's the Security Component that's creating a duplicate of my input:

<?php echo $this->Form->input('39', array('type'=>'checkbox')); ?>

Becomes:

<input type="hidden" name="39" id="Form39_" value="0"/>
<input type="checkbox" name="39"  value="1" id="Form39"/>

Maybe this works fine in most scenarios? (Cake ignores it?)

But my form is of GET method, so when I submit, I get this:

...&39=0&39=1...  in the URL

Or, if I don't check the box, I get this:

...&39=0  (shouldn't even be there)

How can I it to either a) not create a duplicate or b) don't submit both during GET submits?

도움이 되었습니까?

해결책

This should help:

<?php
echo $this->Form->checkbox('39', array('hiddenField' => false));
?>

Form Helper

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top