Re: form on one page submits to another model - validation to show on original page?

2006-06-14 Thread [EMAIL PROTECTED]

Hey John and Nate, thx for your help.

I still cannot get this to work, but found your input helpful anyway!
The flash with Session thing is interesting.

The problem is it redirects fine, but the /pages/ controller seems like
it doesnt consider any tagErrormsg for the invalid data, which is from
the Subscriber model/controller add(), I think perhaps I need to tell
it to check this, perhaps with uses() or something? (Even though there
is no association between the 2 controllers). 

Any ideas?

thanks

Luke


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---



Re: form on one page submits to another model - validation to show on original page?

2006-06-14 Thread [EMAIL PROTECTED]

I shall try and clarify what I am trying to do.

I have a simple form on several static /pages/

it is taking an email address and then submitting this to /subscribers/
controller, and /add action

If this is saved / validated ok, then it will flash and return user to
where they came from.

If it fails validation, I want to REDISPLAY the form, with the
tagErrorMsg showing the relevant error in the form itself.

But I don't know how to get from the section of code in my subscribers
controller after a failed validation, back to the redisplay fo the form
and the error that occuerred. This is to do with the switching from one
controller to another, which I am unclear on how to do. Also how to
pass data between the 2.

cheers
Luke


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---



Re: form on one page submits to another model - validation to show on original page?

2006-06-14 Thread Olivier Percebois-Garve

I use

$this-set('editorcontent', 
$this-requestAction('/bare/editorcontents/showedit/'.$id, 
array('return' = true)));

to get in a form of the edit of CategoriesController the 'display' part 
of the edit in the EditorContents controller.
(So in the case if(empty($this-params['data'])) in the edit 
CategoriesController )

Now in to save the edited values ( case of if 
($this-Category-save($this-params['data']))   ):

 if 
($this-requestAction('/bare/editorcontents/saveedit/'.$this-Category-id, 
array('return'))){

Hope it helps

Olivvv



[EMAIL PROTECTED] wrote:
 I shall try and clarify what I am trying to do.

 I have a simple form on several static /pages/

 it is taking an email address and then submitting this to /subscribers/
 controller, and /add action

 If this is saved / validated ok, then it will flash and return user to
 where they came from.

 If it fails validation, I want to REDISPLAY the form, with the
 tagErrorMsg showing the relevant error in the form itself.

 But I don't know how to get from the section of code in my subscribers
 controller after a failed validation, back to the redisplay fo the form
 and the error that occuerred. This is to do with the switching from one
 controller to another, which I am unclear on how to do. Also how to
 pass data between the 2.

 cheers
 Luke


 

   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---



form on one page submits to another model - validation to show on original page?

2006-06-09 Thread [EMAIL PROTECTED]

Hi

I have a form for someone to add their email address to a database, it
is displayed on each static page i am using in my pages/ section

e.g. pages/home has a one input form

echo $html-formTag('/subscribers/add');
echo $html-input('Subscriber/email', 
array('size' = '40',
'class'='email'));
echo $html-tagErrorMsg('Subscriber/email', 
'Valid Email is
required.');
echo $html-submit('Sign up');

so in my Subscriber model's controller, I have an add() method that
checks the validation, if it passes I just show a flash page if it
saves, but if the validation fails, I want to show the page the person
came from again and show the error of why the submission failed.
 function add() {
if (empty($this-params['data']))
{
//$this-render();
$this-redirect('/pages/home');
}
else
{
 if($this-Subscriber-validates($this-params['data']))
 {
 //ok cool, the stuff is valid
if 
($this-Subscriber-save($this-params['data']))
{
$this-flash('Your email has been added to our
database.','/pages/home');
}
 }
 else
 {
$this-redirect('/pages/home');
//populates
tagErrorMsg('Subscriber/email')
$this-Subscriber-invalidate('email');
$this-render();


 }


}


It must be quite simple, but I cannot get it to work.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---



Re: form on one page submits to another model - validation to show on original page?

2006-06-09 Thread nate

If you have

echo $html-tagErrorMsg('Subscriber/email', 'Valid Email is
required.');

on both pages, it should work.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---



Re: form on one page submits to another model - validation to show on original page?

2006-06-09 Thread John Zimmerman [gmail]
You can also try to use $this-Session-setFlash('Your Message Here'); followed directly by a redirect to your page, 
$this-redirect('/pages/home');In your default layout you would need to do something like this...$this-controller-Session-flash();
This method will work in other situations too.On 6/9/06, nate [EMAIL PROTECTED] wrote:
If you haveecho $html-tagErrorMsg('Subscriber/email', 'Valid Email is
required.');on both pages, it should work.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake PHP 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  -~--~~~~--~~--~--~---