[Catalyst] FormFu: How to ensure a field value is unique?

Hernan Lopes hernanlopes at gmail.com
Mon Jun 3 14:57:59 GMT 2013


There is only one way.. you must check if that id exists wherever you are
saving it... and you can verify in many ways... ie. ajax, or on form submit.
In your case, follow the formhandler docs and you will find a section where
it validates the form... in that point, you can show the error to your
user: 'username already registred'




On Mon, Jun 3, 2013 at 11:31 AM, Carl Franks <fireartist at gmail.com> wrote:

> Hi,
>
> On 2 June 2013 12:33, Bj=F8rn-Helge Mevik <bhx6 at mevik.net> wrote:
>
> >             model: DB::OpusTwikiBrukernavn
>
> > 'resultset' is not defined at /home/bhm/perl5/lib/perl5/HTML/FormFu.pm
> line 498.
>
> HTML::FormFu::Model::DBIC can retrieve the DBIC schema when you set
> either 'schema',
> or both 'context' and 'model',
> or just 'context' by calling for its default model.
>
> resultset() must always be set - so you can't just pass the entire
> resultset name to 'model'.
>
> Try this config instead of the single 'model' above:
>
>     model: DB
>     resultset: OpusTwikiBrukernavn
>
>
> > Use of uninitialized value $name in pattern match (m//) at
> /home/bhm/perl5/lib/perl5/HTML/FormFu/Element.pm line 71.
> > Use of uninitialized value $root in hash element at
> /home/bhm/perl5/lib/perl5/HTML/FormFu/Role/NestedHashUtils.pm line 43.
>
> I don't think this is also immediately linked to your error, but it
> indicates that you're using a field element without a name - this is
> unsupported by FormFu, and may cause other errors.
>
> Carl
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20130603/f045b=
dff/attachment.htm


More information about the Catalyst mailing list