[html-formfu] Validate DBIx::Class unique constraints
Erez Schatz
moonbuzz at gmail.com
Mon Dec 6 11:03:22 GMT 2010
On 12/06/2010 12:58 PM, Carl Franks wrote:
> Ah, I getcha.
> I think the solution here would be to use different forms for the "add
> profile" and the "edit profile" functions.
> The first has the Unique constraint, the second doesn't.
>
> An easy way to reuse the same basic form, if the only difference is
> the constraint, would be something like this:
>
> edit.yml
> ===
> elements:
> - name: username
>
>
> add.yml
> ===
> load_config_file: 'edit.yml'
> constraints:
> - type: 'DBIC::Unique'
> name: username
>
> Will this work for you?
> Carl
It's an excellent solution (Again). Sadly, it's not applicable here. I
*do* need a unique validation for the update form, to prevent user a to
be using user b's email. One solution is to not pre-populate the form
with values from the DB, or place them in labels. But before we try
those changes, I want to make sure there's not a way to use the current
configuration.
--
Erez
Observations, not opinions.
More information about the HTML-FormFu
mailing list