would work for me :)
I would make the signup form invoke the same method that the current
page renders from, but with the signup submit button named "doSignup".
In the AppController I would add a method to process the signup and
invoke it from the beforeFilter method (or the form action method) as:
[code]
if ( isset($this->params['form']) and !empty($this->params['form']) )
{
foreach( $this->params['form'] as $action => $actionValue ) {
switch( $action ) {
case 'doSignup" :
... invoke signup processing method ...
...
}
}
}
[/code]
This should ensure that any validation errors are returned together
with the view and your flash message.
Ok, have to admit, the solution is not tested, as my issue was a
little different than yours, but the idea is the same.
Enjoy,
John
On Feb 4, 6:41 pm, "Dave" <make.cake.b...@gmail.com> wrote:
> Almost correct in assuming.
>
> Every page has the sign-up.
>
> PageA
> PageB
> PageZ and everything in between.
>
> So sign up click and request goes to newsletters_controler / add so if it
> saves I have redirect referrer so presto back to where I started. If not I
> get the session flash error message back where I was but the form has no
> errors hilighted saying why failed.
>
> -----Original Message-----
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
>
> Of John Andersen
> Sent: February-04-10 4:16 AM
> To: CakePHP
> Subject: Re: Form in element
>
> If I understand you correctly Dave, then you have a page A on which is a
> newsletter signup form. When the user submits an e-mail address, you want to
> present the user to page B if the e-mail address is valid. If the e-mail
> address is not valid, stay on page A. Correct?
>
> Assuming I am correct :) ... in the controller receiving the newsletter
> signup submit - if the e-mail address is valid, redirect the user to page B.
> If the e-mail address is not valid, redirect the user to page A, using
> $this->referer() as the redirect address.
>
> Enjoy,
> John
[snip]
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 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:
Post a Comment