Calvin: data is being written to the value="" of the tag - so its not the
browser doing it...

cricket: form is an add form - there is no reading going on, no else....

i've even tried explicitly unsetting the keys for $this->data that i want to
clear but it still finds its way into the form some how....

Its on a signup form using Auth Component if that makes any difference?
(though the form isn't bound to the user table, i'm performing validation on
dummy fields then in the model writing to the correct fields if the dummy
fields pass validation).



On Mon, Apr 26, 2010 at 3:04 AM, cricket <[email protected]> wrote:

> On Apr 25, 1:19 am, Greg Skerman <[email protected]> wrote:
> > Hey guys,
> >
> > Trying to work out how to clear a form field if that field fails
> validation.
> >
> > I've tried doing an unset($this->data['Model']['fieldname']) but the data
> > still seems to persist in the form when it is returned to the user to
> > correct validation errors.
>
> Are you sure that you're not overwriting it yourself? A common mistake
> is to do something like this:
>
> public function edit($id = null)
> {
>        if (!empty($this->data))
>        {
>                // pseudocode
>                if (validate + save)
>                {
>                        // redirect
>                }
>        }
>
>        // if above fails you'll be here
>
>        $this->data = $this->Foo->read(null, $id);
> }
>
> The read() line should be wrapped in an else block so that it's not
> called if data was submitted.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<cake-php%[email protected]>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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