[html-formfu] constraint in repeatable
Josef Chladek
josef.chladek at gmail.com
Sat Dec 19 13:55:24 GMT 2009
Am 19.12.2009 um 12:37 schrieb Josef Chladek:
> btw, I have 5 of those selects in the form, which need all to be present (which works now) AND should be unique. I can achieve this by making a unique constraint in the db and catch the error in an eval around $form->model->update. my problem: how can I force_error on the correct field? I can't seem to get the fields within the repeatable block. I normally do this like that:
>
> $form->get_constraint('email')->force_errors(1);
> $form->process;
> $form->form_error_message('not saved');
> $form->force_error_message(1);
>
> how would I select the correct constraint (get_constraint) within the repeatable block? or is there an easier way to have unique select values within the repeatable block without evaling the db call?
found a way to make this work:
addedd
validator: 'Cat::UniqueCopmanyInDepots'
in my config, made
Cat/lib/HTML/FormFu/Validator/Cat/UniqueCopmanyInDepots.pm
as described in http://search.cpan.org/~cfranks/HTML-FormFu-0.06000/lib/HTML/FormFu/Validator.pm
very nice solution - thanks for that carl!
josef
More information about the HTML-FormFu
mailing list