我的觀點刀片這樣的:爲什麼驗證兩個複選框在一個表單不工作laravel?
...
<div class="checkbox">
<label>
{{Form::checkbox('is_anonymous', 1, false)}} As anonymous
</label>
@if ($errors->has('is_anonymous'))
<div class="help-block">
<strong>{{ $errors->first('is_anonymous') }}</strong>
</div>
@endif
</div>
<div class="checkbox">
<label>
{{Form::checkbox('term', 1, false, array('id'=>'term'))}} I aggree
</label>
@if ($errors->has('term'))
<div class="help-block">
<strong>{{ $errors->first('term') }}</strong>
</div>
@endif
</div>
我的驗證這樣的:
public function rules()
{
return [
'is_anonymous' =>'required',
'term' =>'required'
...
];
}
如果代碼執行,驗證不行
似乎沒有消息。無論在複選框上,驗證過程是不同的?
我該如何解決這個問題?
請點擊此鏈接(https://stackoverflow.com/questions/37345363/laravel-validation-checkbox)希望這對你的工作 –
@AddWeb解決方案私人有限公司,我看到該鏈接。但它沒有幫助我。我的問題是我有2複選框 –
等待我會檢查它 –