Create possibility to do calculations
Problem description
The context is as follows. We want to create a form processor where we can register for an event. We can register one or more persons attending the event. Depending on the number of attendees we need to calculate the total event fee (and we want to store that at the contribution)
Possible solution
- Just before a form gets submitted from Drupal or Wordpress we do a calculation.
- Optional we return the calculated value to the user and show this before he or she confirms. (So we can say, hey you have 4 attendees and you need to pay 40 euros in total)
Technical details of the solution
- The form processor needs to have a section to do calculations. Similar as to the retrieval of defaults and validations
- The calculated values could be used in the form processor mappings to the actions. (e.g. you have now
input.first_name
,action.contact.id
, and a new onecalculation.event_fee
) - The drupal and wordpress modules need to have a setting to do calculations and show a confirmation before actual submitting the form