formtools / core

The Form Tools Core.
https://formtools.org
205 stars 78 forks source link

adding values of field for a total #905

Open kdmiller45 opened 1 year ago

kdmiller45 commented 1 year ago

can you add the values of fields ie: day one rent cost+day two rent cost= total rent cost

jweese74 commented 1 year ago

Hint, there are more than a couple ways to accomplish this, in my opinion, all should be using the Submission Pre-Parser module. Unfortunately, I'm not at work at the moment so if this isn't answered by Monday, I'll drop you some more information. To get your thoughts flowing however, think of something like this...

// Get the values of the fields and convert them to numbers $fieldValue1 = floatval($_POST["fieldName01"]); $fieldValue2 = floatval($_POST["fieldName02"]);

// Calculate the sum of the two field values $fieldTotals = $fieldValue1 + $fieldValue2;

// Update the $_POST array with the calculated sum $_POST["fieldTotals"] = $fieldTotals;

On Sat, Apr 1, 2023 at 1:52 PM Keith @.***> wrote:

can you add the values of fields ie: day one rent cost+day two rent cost= total rent cost

— Reply to this email directly, view it on GitHub https://github.com/formtools/core/issues/905, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACED2LSNB7UGMH4U4LJMODLW7BTNBANCNFSM6AAAAAAWPYPAKI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Jeff Weese