Saturday, December 6, 2008

Re: Data Validation error message fails on $this->redirect

Why are you using two actions to begin with?

It seems like your inviting issues using such a manner.

Have you considered sending all the data to the same action, and on
successful validation redirect to the next action? Seems like a
cleaner way to go about things.


On Dec 6, 1:20 am, Renesistemic <i.am.phil.russ...@gmail.com> wrote:
> I've had no luck locating any resource online for resolving my issue
> (which I feel is fairly easy), and thought I'd post it on here to see
> if anyone has input.
>
> I'm trying to use the built-in data validation for submitting a form.
> The originating action, say, "manage_posts", displays the form to the
> user and lets them modify data for that post. When they submit, it
> sends the data to "activate_post".
>
> In the "activate_post" action, I call the if($this->Datavalue->set
> ($this->data) && $this->Datavalue->validates) function to test the
> data, and if that test fails I redirect back to "manage_posts"...
>
> The actual validation process seems to be functioning. It accepts
> valid data and redirects on invalid data. However, when it redirects
> to the previous action, it doesn't actually display the error message
> for that HTML element
>
> In the original form, I am in fact calling $this->Form->error
> ($datavalue, $error_msg) after generating the HTML element with $this-
>
> >Form->input().
>
> Likewise, I have other actions throughout my application that use data
> validation and work correctly. However, they don't redirect to another
> action on failing validation. An example would be an action to
> "add_posts"... When the user submits data, it submits to itself,
> tests, and upon validation renders the same action/view.
>
> It seems that I'm only experiencing these problems when I redirect on
> the failure of a data validation. Any thoughts?
--~--~---------~--~----~------------~-------~--~----~
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 cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: