ASP.NET MVC VALIDATOR: Form.valid() is always false using with validator ignore

Viewed 52

I have a dynamic input field in my form separated from the div tag. The active div input field is using display:block and the others inactive div is display:none. So, I searched a lot of possible solutions on how to validate the hidden div with the input fields. I found the validator ignore here. Here's the code

var validatorSettings = $.data($('form')[0], 'validator').settings;
validatorSettings.ignore = "";

The all hidden or display:none can validate also but when I try to put some valid form the result is always false. Here's the code:

if (!myForm.valid()) {
    console.log(myForm.valid());              
    return;
}

I trying to solve this issue almost 2 days. I can't solve this issue. Please help me. Thank you.

1 Answers

I already answered my issue. Instead of using the display:none, I use visibility:hidden

Related