如何在 YII 中没有模型类的情况下在表单中添加文本字段? [英] How to add a textfield in form with out model class in YII?

查看:19
本文介绍了如何在 YII 中没有模型类的情况下在表单中添加文本字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 YII 形式中添加一个文本字段,其中我没有指定任何模型类名称.但我需要在控制器类中的 action 方法中处理该值.

我需要添加一个文本字段

<input type="text" name="test" id="test" >

我将文本字段添加为

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

但我不想在新文本字段中指定任何型号名称..提前致谢...

解决方案

你可以添加一个 Chtml 文本字段 带有 id

它将显示在:$_POST['mytextField']

I need 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...

解决方案

You can add a Chtml textfield with an id

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

这篇关于如何在 YII 中没有模型类的情况下在表单中添加文本字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆