On Fri, Jan 2, 2009 at 2:32 PM, nate <tresbordo...@gmail.com> wrote:
>
> Jörn,
>
> Thanks for your response.
>
> I got it to submit with
>
> submitHandler: function(form) {
>      form.submit();
>      },
>
> now I have a problem when using the cakephp form helper.
>
> This works with the manually created input
>                        rules: {
>                                phone: {phoneUS: true}
>                        }
>
> <input name="phone" id="phone" value="555-555-5555"/>
>
> however I am not sure how to setup the rules when using the cakePHP
> form helper.
> The helper generates the following:
> <input name="data[UserContactDetail][phone]" type="text"
> value="555-555-5555" id="UserContactDetailPhone" />
>
> I have tried using
>                rules: {
>                                data[UserContactDetail][phone]: {phoneUS: true}
>                        }
> and this
>                rules: {
>                                UserContactDetailPhone: {phoneUS: true}
>                        }
> but it doesn't validate.

Nate, I don't know if my previous msg was sent--gmail's acting a bit screwy.

Try putting quotes around the element name:

'data[UserContactDetail][phone]': {phoneUS: true}

Validate uses the name as a key in its rules hash, so I can't see it
working without quotes. (I haven't yet used Validate with Cake's
FormHelper)

I can confirm that jQuery can find the element with:

$('input[name="data[UserContactDetail][phone]"]')

I'm not clear on exactly how Validate gets the element, though. That
code rivals some of Cake's more ... "difficult" classes ;-)

Reply via email to