eZ Community » Forums » Developer » How-to avoid double post into custom...
expandshrink

How-to avoid double post into custom modules

How-to avoid double post into custom modules

Monday 14 December 2009 11:02:10 am - 2 replies

Hi,

I have a custom module who creates eZ objects based on post data.

After the publication made by the module, I would like to redirect the user to some view and disable the possibility to re-post the form (with F5 by example).

The problem is that $module->redirect... does the redirection but post data are still here.

I think a header redirection can do the job but I haven't found how to redirect properly to a custom module/view...

any ideas ?

Modified on Monday 14 December 2009 11:03:24 am by S├ębastien Antoniotti

Monday 14 December 2009 11:19:01 am

Hi,

There are few possibilities. Easiest will be set session variable after object was created and check it before. Or set a remote_id for created object which will be a hash included in the POST array and check if object exists with such remote_id if so then you skip creation process.

Monday 14 December 2009 11:47:23 am

Thanks Lukasz for the advice !

Meanwhile I found the following solution which is to redirect in 301 on the confirmation page.

In this way, post data no longer exist.

// redirect
eZHTTPTool::redirect( eZSys::indexDir().'/member/mywallet', array(), 301 );
eZExecution::cleanExit();

Cheers,

Seb

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu