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

Slack Signup
Newsletter Optin
Help Desk

Custom email notification shortcodes based on field values

Labels

This Discussion is public

Notifications

 

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?

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.

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.

Ok.  How do the hidden field s get their (calculated) values?

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.

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.