Multiple Input Field Validation
See original GitHub issueThis may be a stupid question but how do you add validation for multiple html fields to check if they are empty before submitting? I can retrieve the values of the fields but they need validation.
title: 'Details',
html:
'<p style="float: left;" autofocus>Name:</p>' +
'<input id="swal-input1" class="swal2-input">' +
'<p style="float: left;">Email:</p>' +
'<input id="swal-input2" class="swal2-input">' +
'<p style="float: left;">Description:</p>'+
'<input id="swal-input3" class="swal2-input">' +
'<p style="float: left;">Notes:</p>' +
'<input id="swal-input4" class="swal2-input">',
preConfirm: function () {
return new Promise(function (resolve) {
resolve([
$('#swal-input1').val(),
$('#swal-input2').val(),
$('#swal-input3').val(),
$('#swal-input4').val()
])
})
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Validating multiple fields in a form - javascript - Stack Overflow
I was doing the testing for the first time. I read the this code and made one of my own from it. The...
Read more >Validating multiple inputs as one - FormValidation
In some cases, you need to validate a value which is combined by various fields. For instance, a Birthday field might be a...
Read more >How to validate if input in input field is divisible by or multiple ...
How to validate if input in input field is divisible by or multiple of a number using express-validator ?
Read more >Input Validation with Regex and Multiple sections with Pure ...
I have made validations but without using Regex and multiple sections I want it to make it for my own, and finally I...
Read more >Multiple form validation with one function - JavaScript - SitePoint
Form submission is performed through the form element, with the onsubmit attribute being used to validate the form. If the called script returns ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jesusaugusto0x2 @nhpm have a look to this example. Here we are validating that both username and password are not empty. You can replace that with whatever check you want to implement. The code for the example can be found here
Validation of multiple fields isn’t supported, you should implement it by yourself depending on your project.