The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (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.27 (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.27 (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.27 (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.27 (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.27 (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.27 (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.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
Pressing the stop button during submission causes error - 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: Pressing the stop button during submission causes error (/showthread.php?tid=479)



Pressing the stop button during submission causes error - louie55 - Jan 31st, 2010

A couple seconds after I submitted a form that is integrated with Form Tools, I realized I wanted to put something different into a form field, so I pushed the stop button in the browser. As soon as I did it, I figured I was going to get an error if I submitted it again, and I was right. I got error 302-"Submission is already finalized".

I knew that I had to open the thank you page to clear the session to fix the error, but it made me wonder what would happen if a user of my site did the same thing?

Would this disable the form for all users until the thank you page is opened and the session is cleared? Or will it just effect that single user?

And if it did happen, how can I make it easier for my user to get the form to work again? Should I just put a link on the form to a page that will clear the session and tell them to click it if they are getting errors?

This kind of thing worries me because it might be something that users would do often. Or, if they submit the form and their internet happens to cut out just at that time so that the thank you page isn't opened. Or, who knows how else it can happen.


RE: Pressing the stop button during submission causes error - Ben - Jan 31st, 2010

Interesting... I confess I hadn't considered this scenario...

Probably the simplest solution would be to include an extra parameter to your ft_api_process_form function called may_update_finalized_submissions. I added in that option to allow for people to update their own submissions at a later date, but I think it would work well in this situation too. Here's some example code:

PHP Code:
$params = array(
    
'submit_button' => 'submit',
    
'next_page' => $_SERVER['PHP_SELF'],
    
'form_data' => $_POST,
    
'may_update_finalized_submissions' => true,
    
'finalize' => true
    
);
ft_api_process_form($params); 

You'll probably want to add that option to all pages in your form, just in case.

N.B. I just checked the ft_api_process_form() documentation page for this information and it's totally missing. I'll be sure to update it.

Excellent. I'm really enjoying your feedback in the forums. Lots of good stuff. I'm wondering if perhaps may_update_finalized_submissions should default to true instead of false...?

- Ben


RE: Pressing the stop button during submission causes error - louie55 - Jan 31st, 2010

Ok, thanks, I will try it and let you know how it works.

As for whether it should be set to true or not, I can't tell you for sure since I don't know exactly what it does. But, if you give me more information on exactly what's different if you turn it on, I can give you an opinion.

I can say that anything that cuts down on errors seen by the end user is great! I would much rather have double submissions than to have my users see errors. Many of the users of my site will have little computer experience and I like to keep everything as simple as possible.

In my mind, the code should be set up so that no matter how many times you push the submit button, and stop the current progress, or refresh the page, no errors show up. If the form gets submitted multiple times, then so be it. I can always just delete the duplicates in Form Tools and in my inbox and my end users aren't frustrated with error pages and codes.

(Hey, that brings up an idea for a feature. Have a duplicate record finder that can identify any submissions that are exact duplicates of each other. This might help people find and clean up double submissions in a long submission list.)


RE: Pressing the stop button during submission causes error - louie55 - Feb 1st, 2010

I just tested the code and it worked perfect. I did a few tests, including stopping the browser before the thank you page was shown. I then tried resubmitting after I stopped the browser. I then cleared out the session and pressed the stop button again after submitting, then I refreshed the page multiple times and left and came back and then submitted the form again and I never received a single error.

Everything worked as I would expect from a form mail software. Every time I submitted the form, I received an email with the info and I never saw an error no matter what I did to try to mess it up.

I definitely think that may_update_finalized_submissions should be set to true by default. This should help keep users and website admins happier and error free.


RE: Pressing the stop button during submission causes error - Ben - Feb 2nd, 2010

Yeah, I think you're right. I'm not sure I fully thought through defaulting it to false. I've logged it here:
http://bugs.formtools.org/index.php?cmd=view&id=194

This will be included in the next API update (this weekend, probably).

- Ben