0

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?

Dave
  • 28,833
  • 23
  • 113
  • 183
  • 1
    why are you using a GET request for a form? – swiecki Jun 26 '12 at 20:21
  • swiecki - I assume you're joking. Not that it's funny, but I can't imagine how that could be a serious comment. – Dave Jun 26 '12 at 21:52
  • I guess I was merely being curious about what you were using this form for. From the HTML5 spec: `If the processing of a form is idempotent (i.e. it has no lasting observable effect on the state of the world), then the form method should be GET. Many database searches have no visible side-effects and make ideal applications of query forms. - - If the service associated with the processing of a form has side effects (for example, modification of a database or subscription to a service), the method should be POST.` Also, I do see now that I worded my question awfully. :( – swiecki Jun 27 '12 at 01:25
  • swiecki - While I appreciate you taking the time out of your day to write a comment on my question, it is completely irrelevant as to "why" I'm using GET. I did not ask whether or not I should use POST or GET, nor did I infer that I was curious about when to use or not use POST vs GET. – Dave Jun 27 '12 at 03:52

1 Answers1

1

This should help:

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

Form Helper

Mo3z
  • 2,138
  • 7
  • 21
  • 29