Skip to main content
Changed the JS, $('input:hidden').filter(function () { return this.name = "IsRFD" }).remove(); was not working on all pages
Source Link
messed-up
  • 533
  • 5
  • 12

Yes, the HTML is rendered with two input for same properties like #Stephen Muecke said in his answer. Because both of the input has the same name, the form post doesn't take either one. I didn't find the hidden input very useful so i removed it on page load using JS like below.

 @Html.CheckBoxFor(model => model.IsRFD, new { @class = "checkbox" })
 @Html.LabelFor(model => model.IsRFD)

JS:

 $('input:hidden').filter(function () {
        return this.name = "IsRFD"
    }'input[name="IsRFD"][type="hidden"').remove();

Now it is working perfectly with no problem so far...

Yes, the HTML is rendered with two input for same properties like #Stephen Muecke said in his answer. Because both of the input has the same name, the form post doesn't take either one. I didn't find the hidden input very useful so i removed it on page load using JS like below.

 @Html.CheckBoxFor(model => model.IsRFD, new { @class = "checkbox" })
 @Html.LabelFor(model => model.IsRFD)

JS:

 $('input:hidden').filter(function () {
        return this.name = "IsRFD"
    }).remove();

Now it is working perfectly with no problem so far...

Yes, the HTML is rendered with two input for same properties like #Stephen Muecke said in his answer. Because both of the input has the same name, the form post doesn't take either one. I didn't find the hidden input very useful so i removed it on page load using JS like below.

 @Html.CheckBoxFor(model => model.IsRFD, new { @class = "checkbox" })
 @Html.LabelFor(model => model.IsRFD)

JS:

 $('input[name="IsRFD"][type="hidden"').remove();

Now it is working perfectly with no problem so far...

Source Link
messed-up
  • 533
  • 5
  • 12

Yes, the HTML is rendered with two input for same properties like #Stephen Muecke said in his answer. Because both of the input has the same name, the form post doesn't take either one. I didn't find the hidden input very useful so i removed it on page load using JS like below.

 @Html.CheckBoxFor(model => model.IsRFD, new { @class = "checkbox" })
 @Html.LabelFor(model => model.IsRFD)

JS:

 $('input:hidden').filter(function () {
        return this.name = "IsRFD"
    }).remove();

Now it is working perfectly with no problem so far...