I have a page in which there are a number of dropdowns and
multi-selects, each of which is populated upon the page loading by
quering its own table with the most recent values. These other tables
are very simple two-column set-ups - one for the ID/value and another
for the verbose description.
I am getting the editing/creation stuff working fine. The dropdowns work
with a belongs_to/has_many relationship, while the multi-selects work on
a habtm/habtm relationship.
However, I now want to validate these selected options in the dropdowns
and multiselects (in a way akin to standard model validations so that
the new/edit page reloads with the submitted data and error messages).
By validating these I mean that each option will be checked to see if
that option actually exists in the database or else it will not save the
record. Obviously want to protect against someone submitting
malicious/incorrect data (eg. with non-existent values) through their
own forms they have copied and customised.