Checkbox (hidden field) causing CSS problem
See original GitHub issueWe are using a template that allows for styled checkboxes. The problem occurs when we render the checkbox. It puts a hidden field before the required <label> tag. If the <label> tag does not come directly after the checkbox it will fail to render.
This is the hidden field the code is adding…
<input name="EnableAD" type="hidden" value="false">
This is the non-working result. The hidden input field is rendered before our lablel tag causing it to fail.
<label class="checkbox" for="EnableAD"><input checked="checked" class="ace-switch ace-switch-7" data-val="true" data-val-required="The EnableAD field is required." id="EnableAD" name="EnableAD" type="checkbox" value="true" /> <input name="EnableAD" type="hidden" value="false" /> <span class="required">Enable</span></label>
This is a working result (trying to achieve this output). Notice the hidden input field is not in the label tag.
<label class="checkbox" for="EnableAD"><input checked="checked" class="ace-switch ace-switch-7" data-val="true" data-val-required="The EnableAD field is required." id="EnableAD" name="EnableAD" type="checkbox" value="true" /> <span class="required">Enable</span></label> <input name="EnableAD" type="hidden" value="false" />
So, what we need to find out is how to render or remove the hidden field so our label shows first instead. Any ideas?
Issue Analytics
- State:
- Created 10 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
@DmitryEfimenko described the solution so well. I’m not using Ace template. But I got the same issue. Just changing + to ~ solved my problem. You guys are superb.
The Ace template isn’t free. The fix itself doesn’t involve the code in this repo. If others run into this issue, finding this thread and knowing that the fix lies in the LESS files should provide all the info they need. This little snip might be of use too.