Questions tagged [constraint-validation-api]

The Constraint Validation API allows validation of HTML form inputs before submission. Use this tag for questions about the Constraint validation API.

Constraint Validation API

The Constraint Validation API allows validation of HTML form inputs before submission.

References

47 questions
2
votes
2 answers

HTML5 constraint validation for custom check

I would like to check if username and email address is unique on client side. Is there any way to add custom validation for constraint validation? Or is there any other recommended way for this? I assume I have to send async http request (I am…
BK C.
  • 573
  • 2
  • 7
  • 16
2
votes
1 answer

How to validate html5 constraint validation message using Selenium-Webdriver and Java

How do I validate the following message? The required class has the floating message.: try the following, but I get the error "no such alert" package firsttestngpackage; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import…
2
votes
2 answers

How to include custom field validation function in HTML form validation?

I have custom password validation function in my form. On the same form I use HTML5 validation on all other fields. I'm wondering if there is a good way to include this function in HTML validation? Here is example of my custom password validation…
espresso_coffee
  • 5,980
  • 11
  • 83
  • 193
2
votes
1 answer

How to run HTML validation with onClick JQuery function?

I'm trying to implement HTML validation in my project. Seems very helpful and easy for use. However this validation will work only if input type is set to submit. That part is causing problem for me. I have multiple forms and I use same name…
espresso_coffee
  • 5,980
  • 11
  • 83
  • 193
2
votes
1 answer

Can I make different browsers show HTML form error messages the same way?

I have created a login form with username and password fields. Username should be a a text filed with type email and password will be a text filed with type password which need to satisfy a regex pattern. Everything is working as expected. The issue…
Sha
  • 1,826
  • 5
  • 29
  • 53
2
votes
1 answer

Any workaround of Opera 12's input type=number validity behavior?

I was just troubleshooting an issue with a library of mine but it boils down to being something related with Opera behavior. Now, I haven't found big warnings anywhere on this issue, so my guess is that I'm missing something, or that there's a…
Alpha
  • 7,586
  • 8
  • 59
  • 92
1
vote
1 answer

Why does checkValidity or reportValidity triger automatic submit of a form in jquery?

Consider the following code: $("button[type='submit']").click(function(e){ if($(this).closest("form").checkValidity()) { $(this).closest("form").reportValidity(); } e.preventDefault(); alert("Never happens!!!"); }); If the…
user31782
  • 7,087
  • 14
  • 68
  • 143
1
vote
2 answers

Is there a way to copy validation from one input to another with JavaScript?

I have a client who wants me to punctuate all currency inputs with commas and dollar signs. This means that I have to use a text input instead of a number input, which means that I cannot take advantage of the inbuilt validation that number inputs…
kloddant
  • 1,026
  • 12
  • 19
1
vote
2 answers

Can you call checkValidity() on a
element?

I was looking through the Constraint Validation API and found some example code online that seemed to call checkValidity() on elements: (function() { 'use strict'; window.addEventListener('load', function() { var forms =…
edddd
  • 433
  • 3
  • 17
1
vote
4 answers

How to enter numeric value in input field using Python Selenium?

I've got a script writing values into a web page, and all values write except for one field that keeps throwing up the following error: (Screenshot provided b/c in other similar questions many comments said this is impossible to happen on a web…
1
vote
1 answer

Screen Reader and HTML validation

Using HTML5 validation and screen readers, is there a way to make the screen reader read the HTML validation message? If an invalid email is entered we get an HTML validation message Our…
1
vote
0 answers

Validation message not showing on invalid field if the field is off screen during form submission

I want to leverage HTML5Constraint Validation for a registration form. I have a large number of inputs, and due to this, the submit button is not on screen at the same time as some of the required fields. I've discovered that in MS Edge, if you…
1
vote
0 answers

Are there any disadvantages to overwriting HTMLInputElement.checkValidity?

I want to create custom validity rules for HTML input elements (or polyfill unsupported ones). To blend as well as possible into the browser's native validation procedure, I came up with overwriting the input elements' checkValidity method to hook…
Boldewyn
  • 81,211
  • 44
  • 156
  • 212
1
vote
1 answer

How to show a custom validation message with pattern validation for email

I want my HTML form to show a custom error message when an email address is not in correct format
Mark
  • 3,231
  • 3
  • 32
  • 57
1
vote
1 answer

How can I fix these setCustomValidation unbind issues with my jQuery code

I am using the built-in HTML validation methods to validate the date of birth in a form. The form has three select list elements: user_dob_date user_dob_month user_dob_year All three elements have been put as "required" for validation as the user…