The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.28 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.28 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.28 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.28 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.28 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.28 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.28 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.28 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.28 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.28 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
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.