How do I avoid @ Html.CheckBox to create a hidden field?

Using @ Html.CheckBoxFor creates a hidden box. Is there a way to avoid this?

Why do I want to do this? I was provided with a design that has some script or library used in it to render it visually. It works fine if the Html is in below format (checkbox with label):

<div>
                    <input type="checkbox" value="resources" id="resources" class="cb">
                    <label for="resources">
                        I need an offset facility
                    </label>
                    <i class="tooltip-icon" data-icon="repayments"></i>
                </div>

      

But it doesn't work if there is a hidden field between the checkbox and the label:

 <div>
<input id="HomeLoanLead_Redraw_flexibility_Value" class="cb" type="checkbox" value="true" name="HomeLoanLead.Redraw_flexibility_Value" data-val-required="The Redraw_flexibility_Value field is required." data-val="true">
<input type="hidden" value="false" name="HomeLoanLead.Redraw_flexibility_Value">
<label for="HomeLoanLead_Redraw_flexibility_Value"> I want to make extra repayments </label>
<i class="tooltip-icon" data-icon="loan"></i>
</div>

      

If I try to use <input type=checkbox>

, I am afraid the post will not get out of the model string binding.

Please, help.

+3


source to share





All Articles