Question

So I was reading through this page because I want to add validation to own form, before I am converting the answers to fill in a PDF and email, and I was looking at the example here, but I can't find out for the life of me how they actually have their fields marked as "required". In comparing the address field and the second field I see that they use the word required in the class selection, but how do they use that as the identifier for what fields are required or not?

Was it helpful?

Solution

Quote OP:

"...but I can't find out for the life of me how they actually have their fields marked as required"

They have class="required" inline with the HTML markup...

<input class="required" ...

Quote OP:

"...I see that they use the word required in the class selection, but how do they use that as the identifier for what fields are required or not?"

That's exactly how... by using class="required".

This is only one way that rules can be declared for this plugin. Generally, rules that are normally declared with a true (within the .validate() method), can instead be placed within the class attribute, such as required, digits, email, etc. However, rules that take more complex parameters, such as max, maxlength, min, etc. cannot be declared in this fashion.

This plugin will also recognized HTML5 validation attributes...

<input required="required" ...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top