Live data from Hacker News

Parsley.js: never write a single JavaScript line to validate your forms

parsleyjs.org

21–30 of 80 posts

Re: Parsley.js: never write a single JavaScript line to validate your forms

#21
post #12
post #3

Speaking with my security hat on: This is a really nice library, but you also do the same validations server side right?

Great question. I would usually prefer server side validation, and with the nice integration that Rails provides between form errors and validations on the model, I am not sure how I can use this. Does anybody who uses a Rails stack combine both server side and client side validations?

Adding client side validations offloads some work from your servers. It could reduce the number of total requests that hit your server and overall increase your speed.

This may be premature optimization for a lot of cases but for form heavy apps this could be a useful optimization.

Also saving a round trip to the server can make the UX seem snappier and overall give a better user experience.

Re: Parsley.js: never write a single JavaScript line to validate your forms

#22
This is a clean way to solve the low hanging fruit of form validation, stuff like isItAnEmailAddress().

What I always find messy in web frameworks is doing validations which are more complicated.

For example a radio button choice which hides another form element which would otherwise be mandatory but should now not be filled in at all. Or where supplying a value between certain dates changes another date field from optional to mandatory and also must check that these dates are between certain values dictated by the first date field.

Re: Parsley.js: never write a single JavaScript line to validate your forms

#23
post #12
post #3

Speaking with my security hat on: This is a really nice library, but you also do the same validations server side right?

Great question. I would usually prefer server side validation, and with the nice integration that Rails provides between form errors and validations on the model, I am not sure how I can use this. Does anybody who uses a Rails stack combine both server side and client side validations?

I thought it was standard to have both. Server side validation to keep bad data out and client side validation to provide a nicer UX for the user than a complete page reload and them searching around for what went wrong.

Re: Parsley.js: never write a single JavaScript line to validate your forms

#25

This is a clean way to solve the low hanging fruit of form validation, stuff like isItAnEmailAddress(). What I always find messy in web frameworks is doing validations which are more complicated. For example a radio button choice which hides another form element which would otherwise be mandatory but should now not be filled in at all. Or where supplying a value between certain dates changes another date field from o…

For one of my new projects, that is precisely what I am doing - making it possible to define complicated validation rules in a simple manner (and lots more). Would there be interest if we open-source it?

Re: Parsley.js: never write a single JavaScript line to validate your forms

#26
Very nicely done. Beat me to it. :(

I am working on a library which takes a data definition, renders the form and then validates it before submitting it via ajax. It supports various hooks like manipulate the data before submission etc.

IMHO form rendering (in a standard way) is also a common pain point along with form validation. Anyone interested in this type of library? Any inputs will be highly appreciated.

Re: Parsley.js: never write a single JavaScript line to validate your forms

#27
Looks cool, but the demo right at the top of the "examples" page has two things that IMHO aren't as "UX aware" as described on the landing page:

- The "website" field requires the http:// part of the address - After typing three letters into the "message" fieldarea, an error pops up and tells me the message needs to be at least 20 characters long, while I'm still typing away

I realize this could be tweaked by the user but the demo shouldn't have such logical flaws for a script that's described as "Super #UX focused". ;)

Re: Parsley.js: never write a single JavaScript line to validate your forms

#28
post #25

This is a clean way to solve the low hanging fruit of form validation, stuff like isItAnEmailAddress(). What I always find messy in web frameworks is doing validations which are more complicated. For example a radio button choice which hides another form element which would otherwise be mandatory but should now not be filled in at all. Or where supplying a value between certain dates changes another date field from o…

For one of my new projects, that is precisely what I am doing - making it possible to define complicated validation rules in a simple manner (and lots more). Would there be interest if we open-source it?

Of course :)

Re: Parsley.js: never write a single JavaScript line to validate your forms

#29
post #25

This is a clean way to solve the low hanging fruit of form validation, stuff like isItAnEmailAddress(). What I always find messy in web frameworks is doing validations which are more complicated. For example a radio button choice which hides another form element which would otherwise be mandatory but should now not be filled in at all. Or where supplying a value between certain dates changes another date field from o…

For one of my new projects, that is precisely what I am doing - making it possible to define complicated validation rules in a simple manner (and lots more). Would there be interest if we open-source it?

Quite possibly.

Though I'm not sure how much this could be generalised since complex validation rules are effectively computer programs in themselves.

Not sure what your approach to this problem is, but perhaps one way to do it would be a validation engine that is inherently functional by design.

Of course, ideally it should be something that can plug in to popular web frameworks easily.

Re: Parsley.js: never write a single JavaScript line to validate your forms

#30
post #25

This is a clean way to solve the low hanging fruit of form validation, stuff like isItAnEmailAddress(). What I always find messy in web frameworks is doing validations which are more complicated. For example a radio button choice which hides another form element which would otherwise be mandatory but should now not be filled in at all. Or where supplying a value between certain dates changes another date field from o…

For one of my new projects, that is precisely what I am doing - making it possible to define complicated validation rules in a simple manner (and lots more). Would there be interest if we open-source it?

Would love to see something like this, and if it's useful and easy to drop in, I'd use it.
Post reply on HN