Omeka icon indicating copy to clipboard operation
Omeka copied to clipboard

Share validators between Records and forms

Open zerocrates opened this issue 12 years ago • 4 comments

Zend_Form has nice ways of showing validation errors on a per-field basis, so we use that pretty often.

At the same time, we need to keep the validators that run within a record to keep developers from manually saving invalid records.

It would be nice, and should be possible, to define validators within the Record in such a way that it's easy to bulk-apply them to an Omeka_Form instance so we don't have to specify a bunch of validators twice where we have a form that lets you set basically every piece of data for a record.

zerocrates avatar May 31 '12 18:05 zerocrates

Would be great to share the error messages for each validator too.

jeremyboggs avatar May 31 '12 18:05 jeremyboggs

@clioweb That would be #47, I believe.

zerocrates avatar May 31 '12 18:05 zerocrates

@clioweb That would be #47, I believe.

That seems to just cover duplicate messages among different forms. I meant sharing messages between the form and the record.

jeremyboggs avatar May 31 '12 18:05 jeremyboggs

Ah.

I think this would involve instantiating the validator classes in just one place. That would mean the messages would only be defined once, too.

zerocrates avatar May 31 '12 19:05 zerocrates