Processing fields in forms app before submission

  • Dear Perchers,

    I have a form where people register for a conference and select dates for accommodation.

    I'd like the form to calculate a total fee they have to pay based on the type of registration and the number of nights and email them the total sum they have to pay.

    Could you recommend a way to solve this task?

    I was able to display the total sum by processing the form fields using JavaScript, but I don't know how to have it sent when the form is submitted.

    Thanks a lot!
    Laszlo

  • drewm

    Approved the thread.
  • Hello

    I was able to display the total sum by processing the form fields using JavaScript, but I don't know how to have it sent when the form is submitted.


    One option would be to add a hidden input field and update its value with Javascript. Add a class or some data attributes to target the field in Javascript.


    HTML
    1. <perch:input type="hidden" id="calculated_value" class="update-me">
  • Thanks a lot, Hussein!
    I was able to implement your suggestion and it works fine.


    Drew, thank you for responding too: the form is handled by the perch_forms app and the responses are stored and sent out by email. Is this what you meant?