Hi
After Form A is submitted, the user will be redirected to Form B.
Form B will take certain values from Form A but after the entry created by Form A but once Form B is loaded, the entry created by Form A can be deleted.
I would like to delete an entry created by Form A after submission and successful redirection to Form B.
How can this be done with PHP or Javascript?
I understand "FrmEntry::destroy( $_SESSION['entry_id'])" can be used to delete an entry but this is PHP and I don't know of a hook that can runs after a form is successfully loaded.
Thanks.
Henry
Wouldn't it be easier to not save Form A entries and pass the Form A values to Form B via a query string?
Hi, that's possible but there are about 50 fields so the query string might be too long.
A query string of 50 fields would be too long.
FrmEntry::destroy() does indeed delete an entry and then clears Formidable's db caches of any remnants.
There are no PHP hooks that can detect when a form is successfully loaded into a browser window. That's a Document Object Model (DOM) event that can be detected by jQuery. I think what you need to do is pass the Form A entry id to Form B and save it in a hidden field. This way you can trigger an Ajax call to delete the Form A entry on the server when document.ready() triggers.
If you're not familiar with Ajax, the jQuery sends a request to the server to execute a custom PHP function. The reason you save the Form A entry id in Form B is to pass it as the Ajax parameter to your custom function.
Please login or Register to submit your answer