|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Validate a single fieldHow can I
validate a single field using Ajax?
I am
attempting to use jquery remote feature to check fields for validity. But its
checking the entire model and reporting fields that have not had data entered.
If a form has 3 fields and the user types into the second field for example i
only want to check if that field is valid, not the entire
form.
I am trying
to validate an email to start off with so data[Profile][email] = mytestemail@... gets sent
to cake to validate
How can I
validate only Profile.email? I want to use the same function eventually to
validate other fields so i do not want to hard code 'email' into the function.
Is there a way to get the field name [email] as a variable and then validate
just that rule in the model and return a true or false?
Thanks
Dave --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@... To unsubscribe from this group, send email to cake-php+unsubscribe@... For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Validate a single fieldjust submit only that field the model validation is only triggered for fields that are beeing passed so if there is only one passed form field, only this one will be validated PS: dont use "required''=>true" in your rules or you screw it up On 7 Nov., 17:43, "Dave" <make.cake.b...@...> wrote: > How can I validate a single field using Ajax? > > I am attempting to use jquery remote feature to check fields for validity. > But its checking the entire model and reporting fields that have not had > data entered. If a form has 3 fields and the user types into the second > field for example i only want to check if that field is valid, not the > entire form. > > I am trying to validate an email to start off with so data[Profile][email] = > mytestem...@... gets sent to cake to validate > > How can I validate only Profile.email? I want to use the same function > eventually to validate other fields so i do not want to hard code 'email' > into the function. Is there a way to get the field name [email] as a > variable and then validate just that rule in the model and return a true or > false? > > Thanks > > Dave You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@... To unsubscribe from this group, send email to cake-php+unsubscribe@... For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
RE: Validate a single fieldI am getting closer but still no message shows up in the form. I get the error div appearing but no message. The response sent to the page looks like: FIREFOX JSON TAB: {"valid":false,"data[Profile][email]":{"messages":{"remote":"from cake"}}} I will worry about the actual cake error message later so I just hard coded "from cake" to see if it shows up but I get no message ever. If its valid the error div still shows up. I modified my validate options so they now look like: var validate_options = { rules: { "data[Profile][email]":{remote: {url: "/manage/profiles/validate",type: "post", data: {fieldname: 'email'}}}, }, messages: { } }; Any ideas how why my messages: are not papering or why it error div appears when valid? Any help or suggestions would be great. Thanks Dave -----Original Message----- From: cake-php@... [mailto:cake-php@...] On Behalf Of euromark (munich) Sent: November-07-09 1:56 PM To: CakePHP Subject: Re: Validate a single field just submit only that field the model validation is only triggered for fields that are beeing passed so if there is only one passed form field, only this one will be validated PS: dont use "required''=>true" in your rules or you screw it up On 7 Nov., 17:43, "Dave" <make.cake.b...@...> wrote: > How can I validate a single field using Ajax? > > I am attempting to use jquery remote feature to check fields for validity. > But its checking the entire model and reporting fields that have not > had data entered. If a form has 3 fields and the user types into the > second field for example i only want to check if that field is valid, > not the entire form. > > I am trying to validate an email to start off with so > data[Profile][email] = mytestem...@... gets sent to cake to > validate > > How can I validate only Profile.email? I want to use the same function > eventually to validate other fields so i do not want to hard code 'email' > into the function. Is there a way to get the field name [email] as a > variable and then validate just that rule in the model and return a > true or false? > > Thanks > > Dave --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@... To unsubscribe from this group, send email to cake-php+unsubscribe@... For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |