drroach / formvalidation Goto Github PK
View Code? Open in Web Editor NEWSimplest JavaScript form validation
License: GNU General Public License v3.0
Simplest JavaScript form validation
License: GNU General Public License v3.0
The fv-func()
method makes use of eval()
in order to run the user desired method to validate an input field. The use of this means that the JavaScript engine will have no knowledge of what is about to be ran and as a result is poorly optimized.
The fix for this will be based around replacing the eval()
call with some sort of parser?
hey man, good job on this.
Question:
Trying to produce an error if the input contains white spaces ... using this:
fv-advanced='{"regex": "/^\s$/;", "message": "This field cannot contain spaces."}'
``
But I'm getting the following error:
VM389:1 Uncaught SyntaxError: Unexpected token s in JSON at position 15
at JSON.parse ()
at HTMLInputElement. (VM375 formValidation.js:33)
at HTMLInputElement.dispatch (jquery.min.js:2)
at HTMLInputElement.y.handle (jquery.min.js:2)
Any tips?
thanks,
hey buddy - question.
Would it be possible to run a function or simply apply a JS variable if the input field is validated?
For example, if the field was valid to "addClass" or something similar?
In this case the sumbit button would be hidden if not validated, or vice versa:
$('#datadirbtn').addClass("btn-hidden");
thx!
Having more than one validation check on an input will only run the first validation check.
There's a lengthy and read-worthy discussion about REGEX Mail patterns here.
Basically,
if(val.match(/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i) != null) {
addSuccess(this);
}
marks for example blocks custom endings beyond 4 characters as invalid.
Some even go as far and only check for an @ sign existing in the string
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.