PDA

View Full Version : Generic JavaScript Validator & Web forms 2



vikasbhagwagar
09-13-2006, 01:13 PM
Hello friends,


I have developed an open source "Generic JavaScript Validator"

https://sourceforge.net/projects/js-validator/ (https://sourceforge.net/projects/js-validator/)

I am using some extra form's element like require="yes|no"
pattern = "^regular expression$"
authtype=_email|_zip|_digits|_date|... and much more
errormsg="User's own error message"

Code generator is also designed by me... which generates some code like this...
<input type="text" name="email" required="yes" authtype="_email" errormsg="Please Enter Proper Email" />

Here ...
My validator traverse DOM (any number's of forms) & doing following...
require="yes" => dont allow field empty
authtype="_email" => Match entered email with standard pattern /^[\w]+(\.[\w]+)*@([\w\-]+\.)+[a-zA-Z]{2,7}$/
errormsg="Please Enter Proper Email" it will alert, the msg "Please Enter Proper Email"

I need suggestions, releted to web forms 2
"http://www.w3.org/TR/2006/WD-web-forms-2-20060821/"

According to Web form 2 standards it also uses pattern,require etc attributes of form's elements... So, what are the chances of acceptation of Web forms 2 by I.E. & Firefox in recent future...? So, that i can make my script compitible with webform2's standard.

Regards,
Vikas

mwinter
09-13-2006, 03:01 PM
<input type="text" name="email" required="yes" authtype="_email" errormsg="Please Enter Proper Email" />

I've never been fond of validation systems that require injecting junk into markup. If the extra data has no use as HTML (and it doesn't because browsers will just treat it all as unknown attributes), then it should be included as script data. There are numerous ways to associate such data with the appropriate form control, including ways to allow automated validation (as opposed to writing a submission validator function by hand).



So, what are the chances of acceptation of Web forms 2 by I.E. & Firefox in recent future...?

If the respective developers have any sense, nil. The specification is still under development. Committing to any particular version would be problematic if the details were changed before going to Recommendation.



So, that i can make my script compitible with webform2's standard.

Don't fiddle with non-existent attributes, and you won't ever have to worry about that.

Mike

vikasbhagwagar
09-14-2006, 07:10 AM
Wiil you please check the link
Live Example : http://www.vikaskbh.com/example1.html
W3C Validator : http://validator.w3.org/check?uri=http%3A%2F%2Fwww.vikaskbh.com%2Fexample1.html

Main aim of this project was to reduce any web-developer's development time.

(Any novice web-developer won't have to waste so much time in just javascript validation.)

Thanks for your suggestions.

mwinter
09-14-2006, 02:13 PM
Wiil you please check the link
Live Example : http://www.vikaskbh.com/example1.html
W3C Validator : http://validator.w3.org/check?uri=http%3A%2F%2Fwww.vikaskbh.com%2Fexample1.html

Well, what do you expect me (or anyone else) to say about it? What are we to check for? If you're still worried about conflicting with Web Forms 2, I've already suggested a guaranteed way to avoid that.

Mike