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?

4
  • 1
    why are you using a GET request for a form? Commented Jun 26, 2012 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. Commented Jun 26, 2012 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. :( Commented Jun 27, 2012 at 1: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. Commented Jun 27, 2012 at 3:52

1 Answer 1

1

This should help:

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

Form Helper

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.