Submit GET form with javascript - CakePHP creating duplicate inputs
-
17-06-2021 - |
Frage
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?
Lösung
This should help:
<?php
echo $this->Form->checkbox('39', array('hiddenField' => false));
?>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow