Pass data back to calling form after [Cancel] in Confirm?

NickOg 17 Jul, 2012
Hi

That Confirm action is just the job. One thing that I have not been able to work out is how to pass the edited data back. That is, if using the Confirm action, I realize that I have an error, then [Cancel] can take you back to the calling edit form but I lose any edits made. Is there some way round that? Can one use those save session renew session in the edit form?

I will try it and see but just wondering if some time can be saved. 8)

Regards

Nick
GreyHead 17 Jul, 2012
Hi Nick,

Can one use those save session renew session in the edit form?

Yes.

Bob
NickOg 17 Jul, 2012
Thanks Bob. That almost gets me there.

I should explain that I am using this on a form that edits a database record.

I make some changes to the record loaded from the database. Those edits I make are carried back to the source form via the conformation form - a read only version of the source form. I can see them with dump - and I can use the
$form->data['confirmation_page']=='_back'
to decide that the form should or should not be reloaded from the database.

So the question is how do I prevent the form re-loading the original data form the database?

Something like

if ($reloadFlag){
run the DB Record Loader block
}
else
{
do not run the DB Record Loader block
}


I guess I need some sort of custom code container for the DB Record Loader block

Does that make sense? Do you have any ideas or solutions up your capacious sleeve? 🙂

It could be that I am missing something here as the fact that that $form->data['confirmation_page']=='_back' value is there implies to me that it might be supposed to happen automatically. I will have a look at the other posts on conformation page to see if I have the sequence wrong

Regards

Nick
GreyHead 18 Jul, 2012
Hi Nick,

I don't think that this is handled automatically though it might be - Max does add in clever little tweaks like that.

I can see two methods of handling this:

a) The data is loaded into the $form->action array in the order of the actions in the On Load event. So if you put the Session to Data action after the DB Record Loader anything form the session will over-write data from the database record.

b) A more reliable way would be to use my Event Switcher [GH] action and put code in there to detect the source and fire Event A if is is a new load and Event B if it is a re-load. Then you can put the DB Record Loader action in the Event A box and the Session to Data action in the Event B box. That way you only do one or the other.

Bob
This topic is locked and no more replies can be posted.