Is there a summary anywhere of data entry form validation
techniques for Rails apps? I've come across lots of snippets of
advice but they are all so far-flung that it's hard to sit down and
organize an approach. The kind of thing I'm looking for would
be a simple list with entries like:
1. simplest: Make sure your table model contains a line like
validates_presence_of :LoanID, :message => "is missing"
This will catch the error after the form is submitted by the user.
3. Use DrySQL... (when does this catch the error?)
I don't know much about DrySQL, but I'm sorry to say your
approach doesn't make sense. Validation rules must be part
of your model, so use Rails validations or customized
validations. Keep in mind that your datas can be used
through web clients or other means : WebServices, REST api...
on the client side (let's keep away the JS disactivation pb),
without using rails validations, what will happen if you corrupt
your datas, say during a migration ?
So use Rails validations, then decide if you want client-side
validation with JS to improve the client experience.
In other words, I'd like to see a summary of techniques for
each type of validation that can be applied to a data entry field.
Then I (or the rest of you!) will be able to pick and choose
among the techniques which are best for the particular
situations at hand.
I don't think such a summary exist. You can't trust client
side validation. Do your server-side validations, add if needy
client-side (JS) validation/checking.
Just my 2 cents,