I have found a form with two sections each section increases with its own radio button, so only one at a time There is a visual section and I use the ASP.NET MVC HTML Helper to generate a field like this:
Label 1 & lt; / Labels & gt; & Lt;% = Html.TextBox ("Field 1", Model.IntProperty1)% & gt; & Lt; Label = "type-permanent" class = "radio active" & gt; & Lt; Input type = "radio" name = "type" value = "type2" id = "type2" /> Label 2 and lieutenant; / Labels & gt; & Lt;% = Html.TextBox ("Field2", Model.IntProperty2)%> I also have two functions so that I can determine which section is active:
function isType1 () {return $ ("# Type 1 ") .attr (" check "); } Function isType2 () {return $ ("#type2"). Ether ("check"); } Finally, I have a follow-up verification method installed:
field 1: {expected: isType1, min: 1}, field 2 : {Required: isType2, min: 1} Now, the issue is that if I pass the view to the empty model, then both fields are set to 0 (for int Default). Now if the user fills a few fields and attempts to submit the form, the verification error occurs, though the field is not required in the other section, but there is a value in it - 0, which is not correct because it should be greater than 1 How can I remove it by leaving the clearing areas in the hidden sections before submission of form?
UPDATE I think I need a conditional verification method.
If you can create it, then the required method takes a callback, so you must The necessary verifiers can be created in:
HTH
Comments
Post a Comment