表单的默认值或自动填充值
本帖最后由 ~夜行侠~ 于 2011-10-9 16:06 编辑控制器user.php
class User extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
}
public function index()
{
$this->load->view('password_view');
}
}
视图
password_view.php
<div class="headbar">
<div class="position"><span>系统</span><span>></span><span>用户</span><span>></span><span>修改密码</span></div>
</div>
<div class="content_box">
<div class="content form_content">
<form action="<?php echo site_url('user/checkPassword'); ?>"method="post" name="admin_edit">
<input type='hidden' name='id' />
<table class="form_table">
<col width="150px" />
<col />
<tr>
<th>旧密码:</th>
<td>
<input name='old_pass' type='password' class='normal' id="old_pass" value=""/>
<label>*<?php echo form_error('old_pass'); ?></label>
</td>
</tr>
<tr>
<th>新密码:</th>
<td>
<input name='new_pass' type='password' class='normal' id="new_pass" />
<label>*<?php echo form_error('new_pass'); ?></label>
</td>
</tr>
<tr>
<th>确认新密码:</th>
<td>
<input name='new_pass_confirm' type='password' class='normal' id="new_pass_confirm"/>
<label>*<?php echo form_error('new_pass_confirm'); ?></label>
</td>
</tr>
<tr><td></td><td><button class="submit" type="submit"><span>保 存</span></button></td></tr>
</table>
</form>
</div>
</div>
打开浏览器后:
<input name='old_pass' type='password' class='normal' id="old_pass" value=""/>
这里显示有一个默认的密码了?为什么?
在线等啊~~~ 用火狐才会这样,IE不会! 怎么都没有人路过~~~回答一下的啊! 表示使用正常,么有碰到你这样的 jeongee 发表于 2011-10-9 16:29 static/image/common/back.gif
表示使用正常,么有碰到你这样的
:hug:版子出现啦~~~哎,算了,不理它了,反正是火狐的问题。 本帖最后由 fltn03 于 2011-10-24 16:06 编辑
没明白你的问题,不过你如果想让表单显示默认的值,可以使用site_value()函数,但是在使用前你必须先加载一个文件: $this->load->helper('url');好象是这个文件,我也记不清楚了.希望对你有帮助.但此我也想再问问高手们,在使用表单验证的使用,如何验证下拉列表框为必填字段?比如
视图:
<select name="group_id">
<option value="0">请选择</option>
<option value="1">第一组</option>
<option value="2">第二组</option>
......
<option value="n">第N组</option>
</select>
<?php echo form_error('group_id');?>
控制器中:
$this->load->library('form_validation');
$this->form_validation->set_rules('group_id','分组','required');
if($this->form->validation->run() === false)
{//表单验证失败
return false;
}
else
{
//表单验证成功
//.......进行下一步操作
}
我也出现过这样的问题,不过不是ci框架,在修改密码的时候,会默认一个值,有木有解答的啊 是不是你在ff里面保存密码了啊…… 火狐的缓存比较雷人
页:
[1]
2