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 ...
随机推荐
- PHP Mongodb 基本操作
<?php include "config/config.inc.php";$host = $config['host'];$port = $config['port']; ...
- loadrunner 参数化数据更新方式
数据分配方式: Select next row[选择下一行]: 顺序(Sequential):按照参数化的数据顺序,一个一个的来取. 随机(Random):参数化中的数据,每次随机的从中抽取数据. 唯 ...
- Sharepoint2010突然之间不能打开页面,报503错误The service is unavailable
原因:安装Sahrepoint时的账号出现故障,可能是密码过期等等. 解决方案: 新建windows用户ada,密码设置为永不过期,隶属于:administrators/IIS-WPG/WSS-WPG ...
- BroadcastReceiver接收系统广播消息
Android常用的广播Action常量: ACTION_TIME_CHANGED:系统时间被改变. ACTION_DATE_CHANGED:系统日期被改变. ACTION_TIMEZONE_CHAN ...
- bzoj 2257: [Jsoi2009]瓶子和燃料
#include<cstdio> #include<iostream> #include<algorithm> #include<cmath> usin ...
- HDU 1560 DNA sequence A* 难度:1
http://acm.hdu.edu.cn/showproblem.php?pid=1560 仔细读题(!),则可发现这道题要求的是一个最短的字符串,该字符串的不连续子序列中包含题目所给的所有字符串 ...
- Linux-如何查看登陆shell的类型
输入一个系统不认识的命令(如#ig)获得系统提示 aix/#ig ksh ig not found #echo $ (适用sh/ksh) aix/#echo $ ksh #echo $SHELL(用户 ...
- Excel公式中双引号和单引号输入和显示以及函数的选择确认
[Excel中显示双引号] 1.直接输入双引号“”或单引号“ 2.工式中显示双引号需输入“”“”“”(六个引号)或单引号需输入“”“”(四个引号) [Excel中快速确认已选择的函数] 1.用键盘的上 ...
- FFT快速傅立叶变换的工作原理
实数DFT,复数DFT,FFTFFT是计算DFT的快速算法,但是它是基于复数的,所以计算实数DFT的时候需要将其转换为复数的格式,下图展示了实数DFT和虚数DFT的情况,实数DFT将时域中N点信号转换 ...
- JAVA之关于super的用法
JAVA之关于super的用法 路漫漫其修远兮,吾将上下而求索.——屈原<离骚> 昨天写this用法总结的时候,突然产生了一个问题,请教别人之后,有了自己的一点认识.还是把它写下来,为 ...