The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
2 Forms - Users manage to switch forms without visiting thanks page - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5) +--- Thread: 2 Forms - Users manage to switch forms without visiting thanks page (/showthread.php?tid=2974) |
2 Forms - Users manage to switch forms without visiting thanks page - Shylock - Mar 31st, 2014 Hi I have a situation where there are several forms on one site (on different pages). All single page API forms. All forms have server side PHP validation (and have been working beautifully for years). However we have just discovered if a user visits one form, starts to complete it, realises that they are on the wrong form and then go to the second form without visiting a thank you page in between the variable $fields is not cleared. The result is it seems to validate the second form correctly but submit the date to the first "wrong" forms ID. So we end up with only the data that has exact equivalents being saved to the database in the "wrong" form table. How do I ensure that if a user switches forms mid-way that this can't happen. I feel as this should be really easy by having a different variable name but I don't want to edit the core files. Any ideas? Thanks RE: 2 Forms - Users manage to switch forms without visiting thanks page - Shylock - Mar 31st, 2014 Hi I think I have solved this. I have simply inserted ft_api_clear_form_sessions(); into both forms before the $fields = ft_api_init_form_page(X); So unless I have got this wrong, it clears anything stored in the variable when the page is first loaded so if a user arrives directly from the other form page it can't submit to the wrong ID. If I have a stupid error in my reasoning do let me know. Thanks And just to round things off I have just found this post from Ben: http://forums.formtools.org/showthread.php?tid=1327 Not sure if it is still valid as I haven't tested it yet but having different name spaces for each form certainly makes perfect sense. Ben if that post on namespacing the forms is still correct I'd love to know. RE: 2 Forms - Users manage to switch forms without visiting thanks page - kaamil20 - Apr 4th, 2014 Yes, Users can easily manage it. |