Answer the question
In order to leave comments, you need to log in
Form validation on the client: html5+js || js-bike || jQuery plugins?
Guys, tell me how you usually validate form data on the client *?
*We do not affect the method of sending data and server validation.
Challenge: realtime data validation (i.e. validation on entry, not on form submission) and universality of approach for fast reuse and ease of support. Field types are typical for requests from landing pages.
Answer the question
In order to leave comments, you need to log in
The server describes the validation rules for models. Then in js, validation is done according to the rules from the server,
roughly speaking something like this
validationRules = [{rule : "length > 20", error: "Error"}]
textField.on("change", (element) => {
foreach(var rule in validationRules){
if (!element.Valid(rule.rule)){
element.Errors.Push(rule.Error);
}
}
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question