I have a following code in user's edit page.
= form_for @user do |f| .row .col-sm-4.col-md-4 = f.label :pay_via_zelle, 'Pay Via Zelle:' = f.check_box :pay_via_zelle .row .col-sm-12.col-md-4 = f.submit "Update", class: 'btn btn-primary form-control'
@user object's pay_via_zelle is true in database.
But the problem is when I visit the users edit page, the checkbox is supposed to be checked, but it is not.
Here is the html output generated by above form
<form class="edit_agent" id="edit_agent_162" action="/agents/38285" accept-charset="UTF-8" method="post">
<input name="utf8" type="hidden" value="✓">
<input type="hidden" name="_method" value="patch">
<input type="hidden" name="authenticity_token" value="OdozGg7J1UvlhX0Nol05mHRFAGCgIji5cxYXlprqS62/BUwtaIU7hb+rhem0zE7hIrnzLXRyzfpi1fmSlT9a9A==">
<div class="row">
<div class="col-sm-4 col-md-4">
<label for="agent_pay_via_zelle">Pay Via Zelle:</label>
<input name="agent[pay_via_zelle]" type="hidden" value="0">
<input type="checkbox" value="1" checked="checked" name="agent[pay_via_zelle]" id="agent_pay_via_zelle">
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-4">
<input type="submit" name="commit" value="Update" class="btn btn-primary form-control" data-disable-with="Update">
</div>
</div>
</form>
The checkbox has checked='checked' property, but the checkbox is not checked.
Have I missed anything?
Aucun commentaire:
Enregistrer un commentaire