On Apr 16, 5:57 am, Ambika Kulkarni <[email protected]>
wrote:
> Hi all,
>
> I have Back and Next as two buttons in my view file. Which are used
> for the navigation between the pages.
> Now when i click on Next button It should do the page validation also.
> I have put the code below. Please help me.

I'm not 100% sure but I think what you need to do is create 2 forms,
one for 'back' and the other for 'next. The 2nd one is this page's
form, as normal. The 'back' one, though, consists only of hidden
inputs with the values submitted from the previous step. Meaning,
you'll need to set() some view vars of the latest submitted data for
each next view. It might be easier in this case to not use FormHelper
for the 'back' form and instead use regualr HTML. Just ensure that you
name the elements correctly, ie name="data['model']['field']" value="<?
= $some_var ?>"

Obviously, you'll need to also ensure you're not saving data twice.
So, instead of only doing if(empty($this->data)) you might do
something like:

if (empty($this->data) && !isset($this->data['ModelName']['id']))
{
   /// save the data and redirect to next step
}

// show the form

Or something like that. I know there was a Wizard component or helper
or somesuch at the Bakery a long time ago. You might want to have a
look at that for ideas.

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