Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
Results 1 to 2 of 2
-
02-26-2016, 08:07 AM #1New to the CF scene
- Join Date
- Feb 2016
- Posts
- 1
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Bootstrap Validator - Send message after form validated
Hello,
I have been working around with this Bootstrap Plugin and after all the setup I am just stuck with the confirmation submit message.
I know how to make the message appear (JSFiddle), but not how to do it just when the form is validated.
After few tries here is somewhat that (until I know) should work but it does not.
Do you guys have any clue?Code:$('#form').validator().on('submit', function (e) { if (e.validated.bs.validator()) { $('button').click(function(){ $('.alert').hide() }) } else { $('button').click(function(){ $('.alert').show() }) } })
Thanks!
-
03-06-2016, 01:07 AM #2Regular Coder
- Join Date
- Nov 2005
- Location
- New Mexico, USA
- Posts
- 182
- Thanks
- 21
- Thanked 13 Times in 13 Posts
$('button').click(...) adds an event handler to all the buttons on the page. If I understand your question correctly, that's not what you want.
if you just want to show a message when the submission is not valid, remove the wrapper.
This will hide the alert if the validator returns true and show it if the validator returns false.Code:$('#form').validator().on('submit', function (e) { if (e.validated.bs.validator()) { $('.alert').hide() } else { $('.alert').show() } })2Reikis
I did not arrive at my understanding of the physical universe through my rational mind.
Albert Einstein



Reply With Quote
