[Catalyst] Question about Catalyst::Controller::FormBuilder

Balaji Srinivasan balajione at gmail.com
Sun Apr 29 05:43:54 GMT 2007


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070428/762b2=
9ea/attachment-0001.htm


More information about the Catalyst mailing list