The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Custom email notification shortcodes based on field values
When someone fills out a form, I would like to add some calculated values based on the values in the fields that the user is submitting.
Just as a contrived example, say if a user types in 5.00 in a field, I want to put that amount with tax in the email, so [with_tax] would add $5.35 to the email.
I see there are other shortcodes in the email notification editor that are based on submitted form field values, so I'm guessing it's possible, I just don't know how. Any ideas?
June 23, 2017 at 6:38 pm
Or... If anyone could just tell me how I can add to the list of shortcodes displayed on the email notification customization fields, that would be a good start.
June 24, 2017 at 7:48 am
The easiest way is to add hidden fields to your form that store the results of the calculations. Display those hidden fields in the email. There's very little work involved doing it this way.
June 25, 2017 at 12:17 am
Ok. How do the hidden field s get their (calculated) values?
June 25, 2017 at 11:12 pm
You can update hidden fields with jQuery. jQuery scripts are added to a form in the after fields area on the customize HTML page. The function you create should fire when the amount field is changed and the value with the tax stored in the hidden field.
June 25, 2017 at 11:56 pm
I found a way to do it. I guess my dilemma was that I wouldn't want to depend on the client to do the calculation.
I can use the frm_pre_create_entry hook to modify form values before they are processed
- Doug
Discussion closed.