as_lh
(As)
February 8, 2010, 10:50am
1
Hi, i use the following code to open a formtag:
<?php
echo CHtml::beginForm(array(
'action' => 'hotelSearch/hotelSearch',
'method' => 'get'));
?>
But in the generated HTML, the action defined in the form tag is the action of the form itself (like $_SERVER[‘PHP_SELF’]) and also, the method is “post”.
I can’t really see what i am doing wrong here
mdomba
(Maurizio Domba Cerin)
February 8, 2010, 11:04am
2
try …beginForm(‘hotelSearch/hotelSearch’,‘get’);
also take a look here for a NOTE about using GET … http://www.yiiframew …chtmlbeginform/
as_lh
(As)
February 12, 2010, 2:31pm
3
That doesn’t work. I can use
beginForm('hotelSearch/hotelSearch','get');
without changing the controller. But what if i want to change the controller?
And why does my first attempt not work?
andy_s
(Arekandrei)
February 12, 2010, 3:12pm
4
API: http://www.yiiframework.com/doc/api/CHtml#beginForm-detail
First argument is action, you should pass: array(‘hotelSearch/hotelSearch’),
Second argument is method (‘get’ in your case),
And third argument is an array of html options. For example: array(‘enctype’=>‘multipart/form-data’).