你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
kelson
赞同来自: jiangs
// $rules = array( 'Username' => 'required|alpha_dash|min:6|max:18|unique:users,username', 'EmailAddress' => 'required|email|unique:users,email', 'Password' => 'required|min:8|max:18|confirmed|different:Username', 'Password_confirmation'=>'required' ); $validator = Validator::make(Input::all(),$rules); if ($validator->fails()) { Session::flash('old',Input::only('Username','EmailAddress')); return Redirect::to('join')->withErrors($validator); }
FiveSay - 成武
赞同来自:
jiangs
赵狗胜 - 谢谢帮助过我的人!
$email = Input::get('email'); $password = Input::get('password'); $password_confirmation = Input::get('password_confirmation'); $sex = Input::get('sex'); //dd(Input::all()); //验证数据 $validator = Validator::make( array('email' => $email, 'password' => $password, 'password_confirmation' => $password_confirmation ), array('email' => 'required|email', 'password' => 'required|alpha_num|between:6,12|confirmed' ) );
要回复问题请先登录或注册
5 个回复
kelson
赞同来自: jiangs
FiveSay - 成武
赞同来自:
http://my.oschina.net/5say/blog/186568#OSC_h4_20
jiangs
赞同来自:
'password' => Input::get('password'),
'confirm-password' => Input::get('confirm_password')
);
$rules = array(
'password' => 'required|min:4',
'confirm-password' => 'confirmed|same:password'
);
$validation = Validator::make($formData2, $rules);
if ($validation->fails()) {
return Redirect::action('App\Controllers\Admin\UserController@edit', array($id))->withErrors($validation)->withInput();
}
这样子吗?但是我提交时没有错误信息
jiangs
赞同来自:
html中:
<!-- Password -->
<div class="control-group {{ $errors->has('password') ? 'has-error' : '' }}">
<label class="control-label" for="password" style="font-size: 16px;">密码:</label>
<div class="controls">
{{ Form::password('password', array('class'=>'form-control', 'id' => 'password', 'placeholder'=>'Password', 'value'=>Input::old('password'))) }}
@if ($errors->first('password'))
<span class="help-block">{{ $errors->first('password') }}</span>
@endif
</div>
</div>
<br>
<!-- Confirm Password -->
<div class="control-group {{ $errors->has('confirm-password') ? 'has-error' : '' }}">
<label class="control-label" for="confirm-password" style="font-size: 16px;">确认密码:</label>
<div class="controls">
{{ Form::password('confirm_password', array('class'=>'form-control', 'id' => 'confirm_password', 'placeholder'=>'Confirm Password', 'value'=>Input::old('confirm_password'))) }}
@if ($errors->first('confirm-password'))
<span class="help-block">{{ $errors->first('confirm-password') }}</span>
@endif
</div>
</div>
<br>
控制器中:
$formData2 = array(
'password' => Input::get('password'),
'confirm-password' => Input::get('confirm_password')
);
$rules = array(
'password' => 'required|min:4',
'confirm-password' => 'required|same:password'
);
$validation = Validator::make($formData2, $rules);
if ($validation->fails()) {
return Redirect::action('App\Controllers\Admin\UserController@edit', array($id))->withErrors($validation)->withInput();
}
刚开始我在html中用的是,Form::text导致不能提示两次密码不一致,当我换成Form::password时就可以了,当我输入两次密码不一致时,出现提示信息了
在此非常感谢两位大神!
kelson和FiveSay
赵狗胜 - 谢谢帮助过我的人!
赞同来自: