Forms app events

  • Hi,


    I have a Perch form that presents users with a number of questions from which users can indicate an answer by selecting one item from a group of radio buttons. On submission, I'm showing a thank you page that gets the responses using $_POST and calculates a total score (1 point for each correct answer).


    This is all running correctly and the form submission is stored as expected in the Perch Forms admin.


    What I would also like to do is get the total calculated score into the Forms admin also. What would be the best way to achieve this?


    Are there, for example, form event hooks that would allow me (on submission) to create a hidden field set to the value of the total score?


    Or any other approach?


    Many thanks in advance for any pointers or suggestions.

  • Hi,


    I'd probably look into doing the opposite:

    • Write a custom form handler (custom Perch app)
    • Update your form so your custom app handles the responses <perch:form app="chopperoon_app"></perch:form>. You may also need to add a hidden input field for the total score.
    • Calculate the score in your form handler
    • Add the score to the submitted form's data
    • Redispatch to the Perch Forms app to store the response along with the score


    HTML
    1. <perch:form app="chopperoon_app" id="quiz"></perch:form>