Laravel - 重新填充复选框以勾选或未勾选
In Laravel, if validation failed, it goes back to a same form page. How to repopulate a checkbox to ticked or unticked?
By default, it should be unticked when loading on the page for the first time.
{{ Form::checkbox('custom_address', false,
Input::old('custom_address'), array('class' => 'test')); }}
0 提建议
邀请回答
编辑 收藏 删除 结题 收藏 举报 追加酬金 (90%的用户在追加酬金后获得了解决方案) 当前问题酬金
¥ 0
(可追加 ¥500)
支付方式
扫码支付
加载中...
2
条回答
默认
最新
-
doudie2693
2014-11-11 16:22
关注
You need to set a value for your checkbox, otherwise the
Input
class will always have it empty / unchecked.
Give the checkbox a value of 1, then it should work.
{{ Form::checkbox('custom_address', 1, Input::old('custom_address'), array('class' => 'test')); }}
本回答被题主选为最佳回答
, 对您是否有帮助呢?
本回答被专家选为最佳回答
, 对您是否有帮助呢?
本回答被题主和专家选为最佳回答
, 对您是否有帮助呢?
举报
按下Enter换行,Ctrl+Enter发表内容
查看更多回答(1条)