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 = form.elements['username'].value;
>    if (username == null || (username != '/^[^'"]{6' && username !=
> '40}+$/')) {
>        alertstr += '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.

-=Chris

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to