JQuery.Validate only validates first field [duplicate]












0
















This question already has an answer here:




  • validating multiple textbox having same name with jquery validator validates only first input

    4 answers



  • .valid() only validates first input with jQuery Validation plugin

    1 answer




I've been struggling all day with a JQuery validate issue. Where it only validates the first field.



I've managed to reproduce it here:






$(document).ready(function() {
$('#go').click(function() {

console.log('go clicked');

if ($('#detailsForm').valid()) {
alert('if you see this then the form is valid.');
}

});
});

<!DOCTYPE html>
<html>

<head>
<script data-require="jquery@1.10.0" data-semver="1.10.0" src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
<script data-require="jquery-validate@1.10.0" data-semver="1.10.0" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/jquery.validate.js"></script>
<script data-require="jquery-validate@1.10.0" data-semver="1.10.0" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/additional-methods.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>

<body>
<h1>This doesn't work :(</h1>

<form id="detailsForm">

<div class="row guttered-bottom">

<div class="col-md-6 col-xs-12">


<div class="row">
<div class="col-md-12 col-xs-12">
<br />
First Name<div style="color:#E320C9">*</div>
<div class="input-container">
<input id="ReserveFirstName" type="text" class="input-large input-wide" placeholder="Enter your first name" required="true" />
</div>
</div>
</div>

<div class="row">
<div class="col-md-12 col-xs-12">
<br />
Last Name<div style="color:#E320C9">*</div>
<div class="input-container">
<input id="ReserveLastName" type="text" class="input-large input-wide" placeholder="Enter your last name" required="true" />
</div>
</div>
</div>

</div>


</div>


</form>

<br>

<button id="go">CLICK ME! </button>
</body>

</html>





Steps to reproduce: click the button and observe that the validation message comes up for the first field (first name). Enter a first name and click the button again. Notice that the form seems to validate even though both fields are required.



What am I doing wrong?










share|improve this question















marked as duplicate by Sparky jquery
Users with the  jquery badge can single-handedly close jquery questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 20 '18 at 3:59


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • I don't think this is quite a duplicate. It's similar yes but not a duplicate question.

    – Prime By Design
    Nov 20 '18 at 16:26











  • For this plugin to work, the form input elements need to have unique name attributes. If they are not unique or they are missing, the symptom is exactly what you describe. Whether validation is triggered manually by a button or programmatically by the .valid() method is irrelevant.

    – Sparky
    Nov 21 '18 at 16:39
















0
















This question already has an answer here:




  • validating multiple textbox having same name with jquery validator validates only first input

    4 answers



  • .valid() only validates first input with jQuery Validation plugin

    1 answer




I've been struggling all day with a JQuery validate issue. Where it only validates the first field.



I've managed to reproduce it here:






$(document).ready(function() {
$('#go').click(function() {

console.log('go clicked');

if ($('#detailsForm').valid()) {
alert('if you see this then the form is valid.');
}

});
});

<!DOCTYPE html>
<html>

<head>
<script data-require="jquery@1.10.0" data-semver="1.10.0" src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
<script data-require="jquery-validate@1.10.0" data-semver="1.10.0" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/jquery.validate.js"></script>
<script data-require="jquery-validate@1.10.0" data-semver="1.10.0" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/additional-methods.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>

<body>
<h1>This doesn't work :(</h1>

<form id="detailsForm">

<div class="row guttered-bottom">

<div class="col-md-6 col-xs-12">


<div class="row">
<div class="col-md-12 col-xs-12">
<br />
First Name<div style="color:#E320C9">*</div>
<div class="input-container">
<input id="ReserveFirstName" type="text" class="input-large input-wide" placeholder="Enter your first name" required="true" />
</div>
</div>
</div>

<div class="row">
<div class="col-md-12 col-xs-12">
<br />
Last Name<div style="color:#E320C9">*</div>
<div class="input-container">
<input id="ReserveLastName" type="text" class="input-large input-wide" placeholder="Enter your last name" required="true" />
</div>
</div>
</div>

</div>


</div>


</form>

<br>

<button id="go">CLICK ME! </button>
</body>

</html>





Steps to reproduce: click the button and observe that the validation message comes up for the first field (first name). Enter a first name and click the button again. Notice that the form seems to validate even though both fields are required.



What am I doing wrong?










share|improve this question















marked as duplicate by Sparky jquery
Users with the  jquery badge can single-handedly close jquery questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 20 '18 at 3:59


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • I don't think this is quite a duplicate. It's similar yes but not a duplicate question.

    – Prime By Design
    Nov 20 '18 at 16:26











  • For this plugin to work, the form input elements need to have unique name attributes. If they are not unique or they are missing, the symptom is exactly what you describe. Whether validation is triggered manually by a button or programmatically by the .valid() method is irrelevant.

    – Sparky
    Nov 21 '18 at 16:39














0












0








0









This question already has an answer here:




  • validating multiple textbox having same name with jquery validator validates only first input

    4 answers



  • .valid() only validates first input with jQuery Validation plugin

    1 answer




I've been struggling all day with a JQuery validate issue. Where it only validates the first field.



I've managed to reproduce it here:






$(document).ready(function() {
$('#go').click(function() {

console.log('go clicked');

if ($('#detailsForm').valid()) {
alert('if you see this then the form is valid.');
}

});
});

<!DOCTYPE html>
<html>

<head>
<script data-require="jquery@1.10.0" data-semver="1.10.0" src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
<script data-require="jquery-validate@1.10.0" data-semver="1.10.0" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/jquery.validate.js"></script>
<script data-require="jquery-validate@1.10.0" data-semver="1.10.0" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/additional-methods.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>

<body>
<h1>This doesn't work :(</h1>

<form id="detailsForm">

<div class="row guttered-bottom">

<div class="col-md-6 col-xs-12">


<div class="row">
<div class="col-md-12 col-xs-12">
<br />
First Name<div style="color:#E320C9">*</div>
<div class="input-container">
<input id="ReserveFirstName" type="text" class="input-large input-wide" placeholder="Enter your first name" required="true" />
</div>
</div>
</div>

<div class="row">
<div class="col-md-12 col-xs-12">
<br />
Last Name<div style="color:#E320C9">*</div>
<div class="input-container">
<input id="ReserveLastName" type="text" class="input-large input-wide" placeholder="Enter your last name" required="true" />
</div>
</div>
</div>

</div>


</div>


</form>

<br>

<button id="go">CLICK ME! </button>
</body>

</html>





Steps to reproduce: click the button and observe that the validation message comes up for the first field (first name). Enter a first name and click the button again. Notice that the form seems to validate even though both fields are required.



What am I doing wrong?










share|improve this question

















This question already has an answer here:




  • validating multiple textbox having same name with jquery validator validates only first input

    4 answers



  • .valid() only validates first input with jQuery Validation plugin

    1 answer




I've been struggling all day with a JQuery validate issue. Where it only validates the first field.



I've managed to reproduce it here:






$(document).ready(function() {
$('#go').click(function() {

console.log('go clicked');

if ($('#detailsForm').valid()) {
alert('if you see this then the form is valid.');
}

});
});

<!DOCTYPE html>
<html>

<head>
<script data-require="jquery@1.10.0" data-semver="1.10.0" src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
<script data-require="jquery-validate@1.10.0" data-semver="1.10.0" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/jquery.validate.js"></script>
<script data-require="jquery-validate@1.10.0" data-semver="1.10.0" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/additional-methods.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>

<body>
<h1>This doesn't work :(</h1>

<form id="detailsForm">

<div class="row guttered-bottom">

<div class="col-md-6 col-xs-12">


<div class="row">
<div class="col-md-12 col-xs-12">
<br />
First Name<div style="color:#E320C9">*</div>
<div class="input-container">
<input id="ReserveFirstName" type="text" class="input-large input-wide" placeholder="Enter your first name" required="true" />
</div>
</div>
</div>

<div class="row">
<div class="col-md-12 col-xs-12">
<br />
Last Name<div style="color:#E320C9">*</div>
<div class="input-container">
<input id="ReserveLastName" type="text" class="input-large input-wide" placeholder="Enter your last name" required="true" />
</div>
</div>
</div>

</div>


</div>


</form>

<br>

<button id="go">CLICK ME! </button>
</body>

</html>





Steps to reproduce: click the button and observe that the validation message comes up for the first field (first name). Enter a first name and click the button again. Notice that the form seems to validate even though both fields are required.



What am I doing wrong?





This question already has an answer here:




  • validating multiple textbox having same name with jquery validator validates only first input

    4 answers



  • .valid() only validates first input with jQuery Validation plugin

    1 answer







$(document).ready(function() {
$('#go').click(function() {

console.log('go clicked');

if ($('#detailsForm').valid()) {
alert('if you see this then the form is valid.');
}

});
});

<!DOCTYPE html>
<html>

<head>
<script data-require="jquery@1.10.0" data-semver="1.10.0" src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
<script data-require="jquery-validate@1.10.0" data-semver="1.10.0" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/jquery.validate.js"></script>
<script data-require="jquery-validate@1.10.0" data-semver="1.10.0" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/additional-methods.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>

<body>
<h1>This doesn't work :(</h1>

<form id="detailsForm">

<div class="row guttered-bottom">

<div class="col-md-6 col-xs-12">


<div class="row">
<div class="col-md-12 col-xs-12">
<br />
First Name<div style="color:#E320C9">*</div>
<div class="input-container">
<input id="ReserveFirstName" type="text" class="input-large input-wide" placeholder="Enter your first name" required="true" />
</div>
</div>
</div>

<div class="row">
<div class="col-md-12 col-xs-12">
<br />
Last Name<div style="color:#E320C9">*</div>
<div class="input-container">
<input id="ReserveLastName" type="text" class="input-large input-wide" placeholder="Enter your last name" required="true" />
</div>
</div>
</div>

</div>


</div>


</form>

<br>

<button id="go">CLICK ME! </button>
</body>

</html>





$(document).ready(function() {
$('#go').click(function() {

console.log('go clicked');

if ($('#detailsForm').valid()) {
alert('if you see this then the form is valid.');
}

});
});

<!DOCTYPE html>
<html>

<head>
<script data-require="jquery@1.10.0" data-semver="1.10.0" src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
<script data-require="jquery-validate@1.10.0" data-semver="1.10.0" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/jquery.validate.js"></script>
<script data-require="jquery-validate@1.10.0" data-semver="1.10.0" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.0/additional-methods.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>

<body>
<h1>This doesn't work :(</h1>

<form id="detailsForm">

<div class="row guttered-bottom">

<div class="col-md-6 col-xs-12">


<div class="row">
<div class="col-md-12 col-xs-12">
<br />
First Name<div style="color:#E320C9">*</div>
<div class="input-container">
<input id="ReserveFirstName" type="text" class="input-large input-wide" placeholder="Enter your first name" required="true" />
</div>
</div>
</div>

<div class="row">
<div class="col-md-12 col-xs-12">
<br />
Last Name<div style="color:#E320C9">*</div>
<div class="input-container">
<input id="ReserveLastName" type="text" class="input-large input-wide" placeholder="Enter your last name" required="true" />
</div>
</div>
</div>

</div>


</div>


</form>

<br>

<button id="go">CLICK ME! </button>
</body>

</html>






javascript jquery jquery-validate






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 3:50









Sparky

82.2k20148238




82.2k20148238










asked Nov 19 '18 at 18:20









Prime By DesignPrime By Design

7161028




7161028




marked as duplicate by Sparky jquery
Users with the  jquery badge can single-handedly close jquery questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 20 '18 at 3:59


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Sparky jquery
Users with the  jquery badge can single-handedly close jquery questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 20 '18 at 3:59


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • I don't think this is quite a duplicate. It's similar yes but not a duplicate question.

    – Prime By Design
    Nov 20 '18 at 16:26











  • For this plugin to work, the form input elements need to have unique name attributes. If they are not unique or they are missing, the symptom is exactly what you describe. Whether validation is triggered manually by a button or programmatically by the .valid() method is irrelevant.

    – Sparky
    Nov 21 '18 at 16:39



















  • I don't think this is quite a duplicate. It's similar yes but not a duplicate question.

    – Prime By Design
    Nov 20 '18 at 16:26











  • For this plugin to work, the form input elements need to have unique name attributes. If they are not unique or they are missing, the symptom is exactly what you describe. Whether validation is triggered manually by a button or programmatically by the .valid() method is irrelevant.

    – Sparky
    Nov 21 '18 at 16:39

















I don't think this is quite a duplicate. It's similar yes but not a duplicate question.

– Prime By Design
Nov 20 '18 at 16:26





I don't think this is quite a duplicate. It's similar yes but not a duplicate question.

– Prime By Design
Nov 20 '18 at 16:26













For this plugin to work, the form input elements need to have unique name attributes. If they are not unique or they are missing, the symptom is exactly what you describe. Whether validation is triggered manually by a button or programmatically by the .valid() method is irrelevant.

– Sparky
Nov 21 '18 at 16:39





For this plugin to work, the form input elements need to have unique name attributes. If they are not unique or they are missing, the symptom is exactly what you describe. Whether validation is triggered manually by a button or programmatically by the .valid() method is irrelevant.

– Sparky
Nov 21 '18 at 16:39












2 Answers
2






active

oldest

votes


















2














jQuery Validate needs each input to have a name attribute. Without this, it can't properly create the input objects it uses to store validation results.



Just add a unique name to each input and you should be good:



<input name="ReserveFirstName" id="ReserveFirstName" type="text" class="input-large input-wide" placeholder="Enter your first name" required="true" />

<input name="ReserveLastName" id="ReserveLastName" type="text" class="input-large input-wide" placeholder="Enter your last name" required="true" />





share|improve this answer


























  • Pat I wish I'd asked this earlier rather than struggling! thank you so much! I can't accept this answer for another 10 minutes.

    – Prime By Design
    Nov 19 '18 at 18:25








  • 4





    Similarly a form won't submit inputs with no name which is also why they get ignored for validation

    – charlietfl
    Nov 19 '18 at 18:25













  • @charlietfl good to know but shouldn't affect me in this case. Thanks though I upvoted you for that.

    – Prime By Design
    Nov 19 '18 at 18:26













  • Np @PrimeByDesign - the same thing got me years ago.

    – Pat
    Nov 19 '18 at 18:27






  • 1





    Validate also ignores fields that are disabled. Not applicable to your issue, but just an fyi.

    – Taplar
    Nov 19 '18 at 18:27



















-3














Valid returns a boolean value from the form but It has to be used before the onClick event.



var form = $( "#myform" );
form.validate();
$( "button" ).click(function() {
alert( "Valid: " + form.valid() );
});


You can try this yourself at the source: https://jqueryvalidation.org/valid/






share|improve this answer
























  • That he should call a variable validating all the form before the onclick event?¿

    – David Bros
    Nov 19 '18 at 18:30


















2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














jQuery Validate needs each input to have a name attribute. Without this, it can't properly create the input objects it uses to store validation results.



Just add a unique name to each input and you should be good:



<input name="ReserveFirstName" id="ReserveFirstName" type="text" class="input-large input-wide" placeholder="Enter your first name" required="true" />

<input name="ReserveLastName" id="ReserveLastName" type="text" class="input-large input-wide" placeholder="Enter your last name" required="true" />





share|improve this answer


























  • Pat I wish I'd asked this earlier rather than struggling! thank you so much! I can't accept this answer for another 10 minutes.

    – Prime By Design
    Nov 19 '18 at 18:25








  • 4





    Similarly a form won't submit inputs with no name which is also why they get ignored for validation

    – charlietfl
    Nov 19 '18 at 18:25













  • @charlietfl good to know but shouldn't affect me in this case. Thanks though I upvoted you for that.

    – Prime By Design
    Nov 19 '18 at 18:26













  • Np @PrimeByDesign - the same thing got me years ago.

    – Pat
    Nov 19 '18 at 18:27






  • 1





    Validate also ignores fields that are disabled. Not applicable to your issue, but just an fyi.

    – Taplar
    Nov 19 '18 at 18:27
















2














jQuery Validate needs each input to have a name attribute. Without this, it can't properly create the input objects it uses to store validation results.



Just add a unique name to each input and you should be good:



<input name="ReserveFirstName" id="ReserveFirstName" type="text" class="input-large input-wide" placeholder="Enter your first name" required="true" />

<input name="ReserveLastName" id="ReserveLastName" type="text" class="input-large input-wide" placeholder="Enter your last name" required="true" />





share|improve this answer


























  • Pat I wish I'd asked this earlier rather than struggling! thank you so much! I can't accept this answer for another 10 minutes.

    – Prime By Design
    Nov 19 '18 at 18:25








  • 4





    Similarly a form won't submit inputs with no name which is also why they get ignored for validation

    – charlietfl
    Nov 19 '18 at 18:25













  • @charlietfl good to know but shouldn't affect me in this case. Thanks though I upvoted you for that.

    – Prime By Design
    Nov 19 '18 at 18:26













  • Np @PrimeByDesign - the same thing got me years ago.

    – Pat
    Nov 19 '18 at 18:27






  • 1





    Validate also ignores fields that are disabled. Not applicable to your issue, but just an fyi.

    – Taplar
    Nov 19 '18 at 18:27














2












2








2







jQuery Validate needs each input to have a name attribute. Without this, it can't properly create the input objects it uses to store validation results.



Just add a unique name to each input and you should be good:



<input name="ReserveFirstName" id="ReserveFirstName" type="text" class="input-large input-wide" placeholder="Enter your first name" required="true" />

<input name="ReserveLastName" id="ReserveLastName" type="text" class="input-large input-wide" placeholder="Enter your last name" required="true" />





share|improve this answer















jQuery Validate needs each input to have a name attribute. Without this, it can't properly create the input objects it uses to store validation results.



Just add a unique name to each input and you should be good:



<input name="ReserveFirstName" id="ReserveFirstName" type="text" class="input-large input-wide" placeholder="Enter your first name" required="true" />

<input name="ReserveLastName" id="ReserveLastName" type="text" class="input-large input-wide" placeholder="Enter your last name" required="true" />






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 19 '18 at 18:26

























answered Nov 19 '18 at 18:23









PatPat

21.5k55262




21.5k55262













  • Pat I wish I'd asked this earlier rather than struggling! thank you so much! I can't accept this answer for another 10 minutes.

    – Prime By Design
    Nov 19 '18 at 18:25








  • 4





    Similarly a form won't submit inputs with no name which is also why they get ignored for validation

    – charlietfl
    Nov 19 '18 at 18:25













  • @charlietfl good to know but shouldn't affect me in this case. Thanks though I upvoted you for that.

    – Prime By Design
    Nov 19 '18 at 18:26













  • Np @PrimeByDesign - the same thing got me years ago.

    – Pat
    Nov 19 '18 at 18:27






  • 1





    Validate also ignores fields that are disabled. Not applicable to your issue, but just an fyi.

    – Taplar
    Nov 19 '18 at 18:27



















  • Pat I wish I'd asked this earlier rather than struggling! thank you so much! I can't accept this answer for another 10 minutes.

    – Prime By Design
    Nov 19 '18 at 18:25








  • 4





    Similarly a form won't submit inputs with no name which is also why they get ignored for validation

    – charlietfl
    Nov 19 '18 at 18:25













  • @charlietfl good to know but shouldn't affect me in this case. Thanks though I upvoted you for that.

    – Prime By Design
    Nov 19 '18 at 18:26













  • Np @PrimeByDesign - the same thing got me years ago.

    – Pat
    Nov 19 '18 at 18:27






  • 1





    Validate also ignores fields that are disabled. Not applicable to your issue, but just an fyi.

    – Taplar
    Nov 19 '18 at 18:27

















Pat I wish I'd asked this earlier rather than struggling! thank you so much! I can't accept this answer for another 10 minutes.

– Prime By Design
Nov 19 '18 at 18:25







Pat I wish I'd asked this earlier rather than struggling! thank you so much! I can't accept this answer for another 10 minutes.

– Prime By Design
Nov 19 '18 at 18:25






4




4





Similarly a form won't submit inputs with no name which is also why they get ignored for validation

– charlietfl
Nov 19 '18 at 18:25







Similarly a form won't submit inputs with no name which is also why they get ignored for validation

– charlietfl
Nov 19 '18 at 18:25















@charlietfl good to know but shouldn't affect me in this case. Thanks though I upvoted you for that.

– Prime By Design
Nov 19 '18 at 18:26







@charlietfl good to know but shouldn't affect me in this case. Thanks though I upvoted you for that.

– Prime By Design
Nov 19 '18 at 18:26















Np @PrimeByDesign - the same thing got me years ago.

– Pat
Nov 19 '18 at 18:27





Np @PrimeByDesign - the same thing got me years ago.

– Pat
Nov 19 '18 at 18:27




1




1





Validate also ignores fields that are disabled. Not applicable to your issue, but just an fyi.

– Taplar
Nov 19 '18 at 18:27





Validate also ignores fields that are disabled. Not applicable to your issue, but just an fyi.

– Taplar
Nov 19 '18 at 18:27













-3














Valid returns a boolean value from the form but It has to be used before the onClick event.



var form = $( "#myform" );
form.validate();
$( "button" ).click(function() {
alert( "Valid: " + form.valid() );
});


You can try this yourself at the source: https://jqueryvalidation.org/valid/






share|improve this answer
























  • That he should call a variable validating all the form before the onclick event?¿

    – David Bros
    Nov 19 '18 at 18:30
















-3














Valid returns a boolean value from the form but It has to be used before the onClick event.



var form = $( "#myform" );
form.validate();
$( "button" ).click(function() {
alert( "Valid: " + form.valid() );
});


You can try this yourself at the source: https://jqueryvalidation.org/valid/






share|improve this answer
























  • That he should call a variable validating all the form before the onclick event?¿

    – David Bros
    Nov 19 '18 at 18:30














-3












-3








-3







Valid returns a boolean value from the form but It has to be used before the onClick event.



var form = $( "#myform" );
form.validate();
$( "button" ).click(function() {
alert( "Valid: " + form.valid() );
});


You can try this yourself at the source: https://jqueryvalidation.org/valid/






share|improve this answer













Valid returns a boolean value from the form but It has to be used before the onClick event.



var form = $( "#myform" );
form.validate();
$( "button" ).click(function() {
alert( "Valid: " + form.valid() );
});


You can try this yourself at the source: https://jqueryvalidation.org/valid/







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 19 '18 at 18:27









David BrosDavid Bros

2016




2016













  • That he should call a variable validating all the form before the onclick event?¿

    – David Bros
    Nov 19 '18 at 18:30



















  • That he should call a variable validating all the form before the onclick event?¿

    – David Bros
    Nov 19 '18 at 18:30

















That he should call a variable validating all the form before the onclick event?¿

– David Bros
Nov 19 '18 at 18:30





That he should call a variable validating all the form before the onclick event?¿

– David Bros
Nov 19 '18 at 18:30



Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)