Closed fedeolivera1 closed 7 years ago
Anyone can give an idea here? Is this happening to someone else?
If I correctly understand what you're asking, this is how the validator is designed to work. Any input that's not marked required
will not be invalid if it's blank. So your second password field isn't invalid even though it doesn't match because providing a value for that field is considered optional.
It sounds like the behavior that you want is for the second password field to be required only if the first password has a value. You can accomplish this by toggling the required
attribute on the second password anytime the first input changes. See this example:
http://jsbin.com/xugetigabe/edit?html,js,output
Hey man!!! That was EXACTLY what I needed thank you!!!!!!. I'm sorry to have opened an issue that were not an issue, and I appreciate very much your help. Your validator is simply awesome, even tough I'm just starting to use it and I know very little about bootstrap and UI. Thank you again man, cheers!
2017-08-23 11:33 GMT-03:00 Cina Saffary notifications@github.com:
If I correctly understand what you're asking, this is how the validator is designed to work. Any input that's not marked required will not be invalid if it's blank. So your second password field isn't invalid even though it doesn't match because providing a value for that field is considered optional.
It sounds like the behavior that you want is for the second password field to be required only if the first password has a value. You can accomplish this by toggling the required attribute on the second password anytime the first input changes. See this example: http://jsbin.com/xugetigabe/edit?html,js,output
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/1000hz/bootstrap-validator/issues/582#issuecomment-324353955, or mute the thread https://github.com/notifications/unsubscribe-auth/AbOPcp9u5OI7TWUaCbxQ3C8WoHZnE-Apks5sbDhPgaJpZM4O8NVP .
glad to help!
Tried directly from the source: http://1000hz.github.io/bootstrap-validator/?underwear=on removing the required attribute on both password fields. If "required" attribute is taken off (not present on both inputs), the second password field will not validate if you leave it blank, of unfilled, and the first password field completed. Is this a bug?