Live data from Hacker News

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

parsleyjs.org

11–20 of 80 posts

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

#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?

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

#14
Nice.

Improve the demo by removing spellcheck from the name field and capitalizaton for ios (and likely other touch devices) where appropriate.

Along the same lines, demonstrate phone number field (number formatting), currency field, and automatically dealing with urls more nicely.

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

#15
post #3

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

Client side and server side validations need (should!) not be the same — i'd make serverside validation stricter. Client side is for eliminating honest mistakes not preflighting exploits.

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

#16
post #3

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

Parsley's aim is to have think about validation just once back end and seamlessly do the same front end with no extra work. But yes that do not exempt you to validate backend ;)

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

#17

The implementation just smacks of AngularJS. In fact, implementing something like this would be just short of trivial using Angular...! If you like the concept of "extending html" as used here then you should probably checkout AngularJS: http://angularjs.org

Sometimes you just don't have or don't need angular or other js framework and just simply want to validate a form ;)

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

#18

I suppose this is more suited to when your models and schema are also defined on the client side? Having just hit this situation (validating a form client-side), I found the best solution was to transport the form schema from the server (because I use Django, I can easily whip up a ModelForm), then push that into a simple Javascript Form object which renders the schema and adds validation. Maybe there's better ways,…

Is the form definition-to-JavaScript code open source, by any chance?

I ported django.forms to JavaScript so I could use it with Node.js, but it also runs on the client: https://github.com/insin/newforms

Could be useful to plug the two together.

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

#19
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?

From a Django background which also provides form errors very easily, it seems at first glance that this would not be needed (and it technically isn't). However, it's often nice to the user to let them know of silly mistakes like passwords not matching or invalid emails before they hit submit and get bombarded with everything at once.

Javascript validation provides convenience, not security.

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

#20
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 usually use both for anything public facing. Server side is for security, client side is for UX. keeping it dry is a problem, obviously, but you don't always want the same validations server- and client-side.
Post reply on HN