开发者

How to add a textfield in form with out model class in YII?

开发者 https://www.devze.com 2023-02-12 23:14 出处:网络
I need 开发者_Python百科to add a text field in YII form in which i am not specify any model class name. But I need to process that value in the action method inside the controller class.

I need 开发者_Python百科to add a text field in YII form in which i am not specify any model class name. But I need to process that value in the action method inside the controller class.

ie

I need to add a text field as

<div class="row">
    <input type="text" name="test" id="test" >
</div>

I add text field as

<?php echo $form->textField($model['groupModel'],'group_name',array('size'=>60,'maxlength'=>128)); ?>

But i do't want to specify any model name with the new text field.. Thanks in advance...


This should work

<div class="row">
    <?php echo CHtml::textField('User[textvalue]', '', array('size'=>60,'maxlength'=>128)); ?>                
</div>

This will give you the text value inside $_POST['User'] as $_POST['User']['textvalue']


You can add a Chtml textfield with an id

It will the show in the: $_POST['mytextField']

0

精彩评论

暂无评论...
验证码 换一张
取 消