yii表单
yii 的dropdownlist,用yii的session可以记下选中的状态
$form = $this->beginWidget('CActiveForm',array('action'=>$this->CreateUrl('exchange/search')));
?>
<div id='add'><span style='font-size:1.2em;margin-right:10px;'>类型:</span>
<?php
$check=Yii::app()->session['check'];
// echo $check;die;
echo $form->dropDownList($loginForm,'check',array('0'=>'未通过','1'=>'通过','2'=>'拒绝'),
array('style'=>'margin-right:30px;width:100px;height:30px','placeholder'=>'用户id',
'options'=>array($check=>array('selected'=>true))))?>
<input type='submit' name='search' value='查询' class='btn btn-success'>
</div>
<?php
$this->endWidget();
yii表单2
<?php $form=$this->beginWidget('CActiveForm')?>
<table style="width:540px;margin-top:1%;">
<tr style="text-align:center; background-color:#198ef0;color:white;">
<td style="font-size:1.3em;height:30px;">添加</td>
</tr>
<tr>
<td><span style="display:inline-block;width:100px;text-align:left;font-size:1.2em;padding-top:5px;padding-bottom:5px;">用户名: </span><?php echo $form->textField($user,'username')?></td>
</tr>
<tr>
<td><span style="display:inline-block;width:100px;text-align:left;font-size:1.2em;padding-top:5px;padding-bottom:5px;">邮箱: </span><?php echo $form->textField($user,'email')?></td>
</tr>
<tr>
<td><span style="display:inline-block;width:100px;text-align:left;font-size:1.2em;padding-top:5px;padding-bottom:5px;">密码: </span><?php echo $form->passwordField($user,'password')?></td>
</tr>
<tr>
<td><span style="display:inline-block;width:100px;margin-left:100px;text-align:left;font-size:1.2em;padding-top:5px;padding-bottom:5px;">角色选择: </span>
<?php $roles=array('0'=>'医生','2'=>'老师','3'=>'军人','4'=>'动漫','5'=>'通话');echo $form->checkBoxList($user,'roles[]',$roles,array('separator'=>' ','style'=>'display:inline-block;'));?></td>
</tr>
<tr>
<td style="padding-top:5px;padding-bottom:5px;"><input type="submit" name="edit" style="width:100px;" class="btn btn-primary" value="添加"></td>
</tr>
</table>
<?php $this->endWidget()?>
其中checkbox横排显示可以在style中加入display:inline-block
yii表单的更多相关文章
- Yii表单模型使用及以数组形式提交表单数据
按Yii文档里的描述,Yii在处理表单的一般过程是: 创建表单对应的模型类,设置字段验证规则 创建表单提交对应的action,处理提交的内容 在视图中创建表单form 在刚刚的一个小项目里,想使用aj ...
- Yii 表单验证规则---总结
Filter: 过滤,'filter'=>'trim',表示去空格 Required:必须的,表示不能为空 Match: 匹配正则,需要和pattern一起使用,定义正则表达式,'pattern ...
- yii表单输入元素
InputElement http://www.yiichina.com/api/CFormInputElement CFormInputElement 可以代表以下基于type属性的表单输入类型: ...
- YII 表单验证规则
官方文档:http://www.yiichina.com/guide/form.model 类参考手册:http://www.yiichina.com/api/CValidatorhttp://www ...
- yii 表单小部件使用
首先创建model层 因为要使用表单小部件 所以要加载相应的组件 这里需要的组件有 yii\widgets\ActiveForm 和 yii\helpers\Html 接下来在model定义的clas ...
- [moka同学笔记]yii表单dropdownlist样式
<?= $form->field($modelUser,'name') ?> <div class="form-group field-community-mobil ...
- Yii表单验证
我之前在朋友的公司拿到他们oa的代码,发现是用Yii写的,oa系统比较简单,但是程序员对Yii的运用比较好,我拿来学习一下.如果有需要,我可以私下分享这个程序,因为是人家的功劳,不在网上公布代码了,只 ...
- yii 表单如何写,action指向哪里?
文本框:textInput(); 密码框:passwordInput(); 单选框:radio(),radioList(); 复选框:checkbox(),checkboxList(); 下拉框:dr ...
- yii表单的各种验证
/验证规则详细配置 public function rules() { // NOTE: you should only define rules for those attributes that ...
随机推荐
- BZOJ1584 [Usaco2009 Mar]Cleaning Up 打扫卫生
令$f[i]$表示以i为结尾的答案最小值,则$f[i] = min \{f[j] + cnt[j + 1][i]^2\}_{1 \leq j < i}$,其中$cnt[j + 1][i]$表示$ ...
- VS2003编译后的网站如何修改代码
VS2003编译后的网站,如果没有源代码,而要修改里面的代码时,可以以以下方式解决: 反编译dll,把找出cs代码文件,然后重新建一个类项目,把此文件中的代码修改后重新生成dll,放在编译的网站中的b ...
- ubuntu14.10设置开机启动服务
1.比如lampp其他的都类似: 我是这么操作:(屌丝初学者) a.把lampp启动程序放到/etc/bin下面 b.vi /etc/rc.local ,加入lampp start(有了第一步就可以这 ...
- windows下mysql主从同步备份步骤
目的:有两台MySQL数据库服务器A和B,使A为主服务器,B为从服务器,初始状态时,A和B中的数据信息相同,当A中的数据发生变化时,B也跟着发生相应的变化,使得A和B的数据信息同步,达到备份的目的. ...
- True bar
真彩bar /***========================================================================= ==== ==== ==== D ...
- [Js]Ajax
一.什么是Ajax 不刷新的情况下读取数据或提交数据 (最早出现ajax:谷歌地图,拖动一下出现一片新的视野) 应用:用户注册.在线聊天.微博 特性:只能从服务器上去读取数据(所以我们需要配置自己的服 ...
- C- struct的使用
数组是二等公民,不能进行整体赋值,或者参数传递,或者作为返回值. But!如果封装在struct内部,就完全不一样了 #include <iostream> using namespace ...
- #数据结构-fib
/////////////////////////////////////////////////////////////////////////////// // // FileName : fic ...
- ubuntu 添加源
edit file : /etc/apt/sources.list add: deb http://mirrors.163.com/ubuntu/ intrepid main restricted ...
- 在shell脚本中进行条件控制以及使用循环
转载请标明:http://www.cnblogs.com/winifred-tang94/ if条件语句语法: if [ 条件表达式 ] then 代码 else 代码 fi 注意:在上面的if条件语 ...