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



Form Tools
Total Field (math) - 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: Total Field (math) (/showthread.php?tid=5105)



Total Field (math) - alexh - Mar 27th, 2015

I'm looking to calculate the sum of several fields and input that number into another field as a total.

I'm thinking of using the submission pre-parser to do this, as I want it to calculate the fields upon submission (or update) and then input the total into the total field. There's no need for the person submitting the form to see the total, just need it on the back end.

Before I get going on trying to figure it out, has anyone done this?

Alex


RE: Total Field (math) - smoring - Aug 18th, 2015

(Mar 27th, 2015, 6:53 AM)alexh Wrote: I'm looking to calculate the sum of several fields and input that number into another field as a total.

I'm thinking of using the submission pre-parser to do this, as I want it to calculate the fields upon submission (or update) and then input the total into the total field. There's no need for the person submitting the form to see the total, just need it on the back end.

Before I get going on trying to figure it out, has anyone done this?

Alex

Alex, did you ever receive an answer for this?


RE: Total Field (math) - alexh - Aug 18th, 2015

Not yet but I was planning on working on this again in the next week or two. My plan is to use the submission pre-parser. I'll definitely post if I get it working!


RE: Total Field (math) - smoring - Aug 19th, 2015

(Aug 18th, 2015, 2:42 PM)alexh Wrote: Not yet but I was planning on working on this again in the next week or two. My plan is to use the submission pre-parser. I'll definitely post if I get it working!

Awesome. BTW, I did figure out why the pre-parser wasn't working for me (I couldn't get it to fire at all). I'll let you know what I come up with on my forms too. Thanks.


RE: Total Field (math) - kruger - Sep 16th, 2016

(Aug 19th, 2015, 7:39 AM)smoring Wrote:
(Aug 18th, 2015, 2:42 PM)alexh Wrote: Not yet but I was planning on working on this again in the next week or two. My plan is to use the submission pre-parser. I'll definitely post if I get it working!

Awesome. BTW, I did figure out why the pre-parser wasn't working for me (I couldn't get it to fire at all). I'll let you know what I come up with on my forms too. Thanks.

Hi guys, hope you well. Just want to findout if you managed to get this working yet? Thanks
[/quote]


RE: Total Field (math) - alexh - Sep 16th, 2016

I ended up finding an easier solution with jQuery I think (sorry this was a while ago!) but I know I never figured out how to do it with the submission pre-parser. Maybe smoring got it working!


RE: Total Field (math) - kruger - Sep 16th, 2016

(Sep 16th, 2016, 8:16 AM)alexh Wrote: I ended up finding an easier solution with jQuery I think (sorry this was a while ago!) but I know I never figured out how to do it with the submission pre-parser. Maybe smoring got it working!

Awesome, thanks alexh.
Did you use the custom fields module to execute the jQuery code?
Thanks
[/quote]


RE: Total Field (math) - alexh - Sep 16th, 2016

I think I did it client side using jquery, putting the calculated total in another field. It may have been a hidden field. Let me do a little research and I'll find where I used this.


RE: Total Field (math) - kruger - Sep 16th, 2016

(Sep 16th, 2016, 8:39 AM)alexh Wrote: I think I did it client side using jquery, putting the calculated total in another field. It may have been a hidden field. Let me do a little research and I'll find where I used this.

That will be great, thanks alexh.
I've tried php and js but struggling to get it to execute math calc from the form fields values the users insert to a total field. Would love to see how you managed to get yours working. Smile


RE: Total Field (math) - paullittrell - Oct 21st, 2016

I know you found your solution through jQuery, but I just thought I would add my 2 cents as I do use the pre-parser for calculations. And someone may need the information in the future.

Mine is setup to calculate on submission and edit for one particular form that I use for tracking QA scores. I am using to rounding function to limit the decimal places. Below is the php code.

$setid = $_POST["$submission_id"];
print_r($setid);
exit;

mysql_query("UPDATE live_form_9 SET `score`=Round((score1+score2+score3+score4+score5+score6+score7)/35*100,2) WHERE submission_id = '$setid'");}