Yii Framework Forum: CHtml::beginForm() doesn't use my Parameters - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CHtml::beginForm() doesn't use my Parameters action and method are ignored Rate Topic: -----

#1 User is offline   as_lh 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 17
  • Joined: 05-January 10

Posted 08 February 2010 - 05:50 AM

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 :(
0

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 08 February 2010 - 06:04 AM

try ...beginForm('hotelSearch/hotelSearch','get');

also take a look here for a NOTE about using GET ... http://www.yiiframew...chtmlbeginform/
Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   as_lh 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 17
  • Joined: 05-January 10

Posted 12 February 2010 - 09:31 AM

View Postmdomba, on 08 February 2010 - 06:04 AM, said:

try ...beginForm('hotelSearch/hotelSearch','get');


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?
0

#4 User is offline   andy_s 

  • Random Member Title
  • Yii
  • Group: Moderators
  • Posts: 1,526
  • Joined: 22-June 09
  • Location:Russia, Kostroma

Posted 12 February 2010 - 10:12 AM

API: http://www.yiiframew...eginForm-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').
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users