On May 14, 2008, at 4:39 PM, Ton Voon wrote:
Hi!
We've just starting playing with FormFu with new Catalyst
application and am impressed with how it works. However, one thing
which I find hard is how to define a field as unique across all the
existing rows.
For instance, we have a list of hosts and we need to ensure that the
host name given in the form is unique. Obviously if the host is
being edited and the name is the same, then the validator should pass.
It looks like a validator callback is the best way to do that, but I
can't see how to integrate this with DBIx::Class. How do others do
this?
We do this by setting something in the form stash before processing,
then the validator can reach this trough the $form->stash method (I
think). This might only work if you implement it as a constraint or
validator class, not as a validator or constraint callback (too long
since I worked with formfu :/)
Anyway, once you have the object beeing worked on, you can check that
the ID or whatever is the same, and return "AOK" then
hope that made some sense
- andreas
_______________________________________________
HTML-FormFu mailing list
[email protected]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu