As a relatively new baker and programmer, for that matter, I ran into
a problem earlier this week.
I was creating a form for users to edit their information however, not
all fields were present in this form for the general member but those
fields happened to be required fields.

In the model those fields non present were set up to validate but,
since they didn't appear in the form (unless you were logged in with
the proper privileges ) the user would never see the validation
errors.

So, upon updating their information they would click "Save Details"
only to be taken back to the edit form, not their profile page.

"Quandary" I thought.

Upon troubleshooting I realized that it was due to the form validating
non-present fields.

A little digging and I pulled this up.
unset($this->User->validate['username']);

Obviously the username is required but it's not changeable.

I add that to the save group in my edit controller action and that
tells the model to ignore validation when it uses the edit action.

So, in closing; If you want to have a form that doesn't have all the
fields in it and some of those fields have validation rules set just
use unset($this->User->validate['fieldname']);
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to