On Tue, Oct 5, 2010 at 11:16 PM, Michael T <michael.to...@gmail.com> wrote: > Hello, > > I have a form in a view which is created using the FormHelper in the > following way: > > echo $this->Form->create(False, array('action' => 'something', 'type' > => 'get')); > > I then have an input for the form defined in the following way: > > echo $this->Form->input('department', array('id' => 'department', > 'options' => $departments, 'empty' => '(select)')); > > When the form type is set to Get in this way, the HTML rendered for > the form input does not contain a name attribute (the name attribute > is empty): > > <select name="" id="department"> ... </select> > > But when I change the form type to Post like this: > > echo $this->Form->create(False, array('action' => 'something', 'type' > => 'post')); > > and render the same input, the resulting HTML is: > > <select id="department" name="data[department]"> ... </select> > > Why does the name disappear for Get type forms?
Odd. Have a poke around FormHelper's source, beginning with the _name() and text() methods. Set some Debugger::log() lines to catch the $options being passed. > I noticed that this > hidden input is not rendered with Get, but it is with Post: > > <div style="display: none;"><input type="hidden" value="POST" > name="_method"></div> I believe that's normal for a GET form. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en