[Catalyst] Question about Catalyst::Controller::FormBuilder
Christopher H. Laco
claco at chrislaco.com
Mon Apr 30 13:53:39 GMT 2007
Balaji Srinivasan wrote:
> Hi There
> I am using Catalyst::Controller::FormBuilder to create my forms. Its
> working
> great for me except for this one issue:
> I would like to specify a field that has a regexp that has a comma in it.
> For example:
> =
> =
> sub doStuff : Path('/doStuff) Form('/doStuff') {
> =
> .....
> }
> =
> My doStuff.fb file has the following field
> =
> fields:
> username:
> label: Username
> size: 40
> validate: /^[^,"]{6,40}$/
> =
> ie I want the username field to contain 6-40 characters without any single
> or double quotes.
> Unfortunately the validation code for this on the javascript side turns
> into:
> =
> var username =3D form.elements['username'].value;
> if (username =3D=3D null || (username !=3D '/^[^'"]{6' && username !=
=3D
> '40}+$/')) {
> alertstr +=3D 'Username should be between 6 and 40 characters
> and should not contain single-quotes (\') or double-quotes (")\n';
> invalid++;
> }
> =
> =
> ie. The value is split at the , sign.
> This looks like it would be a fairly common problem. Any workaround for
> this?
> Thanks
> Balaji
> =
This ia s know, unfixed bug. You options are:
a) manually add the regex to the form in controller code
b) use FB only to render forms, and use something else to validate forms
I opted for b) when I ran into this problem.
-=3DChris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070430/5cfe=
0466/signature.pgp
More information about the Catalyst
mailing list