Forum

Thread tagged as: Question, Problem, Forms

Form - Quiz Help

Hi guys,

Just wondering if anyone has any good ideas on how I can do this. Essentially my form currently has about 12 questions, each answer has a score and on submit I want to add these scores together. Depending on the total score an email is sent however the email is different based on the score you get. So currently I'm wondering if this is actually possible within Perch forms or not. I have already created the form which to give you an idea looks like this:

<perch:form id="quiz" method="post" app="perch_forms">

    <div class="question">
        <perch:label for="question1">How often do you share your feelings with your favourite people?</perch:label>
        <perch:input id="question1" type="radio" options="Never|1, Once or twice a month|2, Once or twice a week|3, Three times a week or more|4, About once a day|5" wrap="div.questionwrapper" />
    </div>

    <div class="question">
        <perch:label for="question2">How much of your day do you spend on social media?</perch:label>
        <perch:input id="question2" type="radio" options="Less than 2 hours|5, 2 to 4 hours|4, 4 to 6 hours|3, 6 to 8 hours|2" wrap="div.questionwrapper" />
    </div>

    <div class="question">
        <perch:label for="question3">How often do you find yourself doing kind things for other people?</perch:label>
        <perch:input id="question3" type="radio" options="Never|1, Once or twice a month|2, Once or twice a week|3, Three times a week or more|4, About once a day|5" wrap="div.questionwrapper" />
    </div>

    <div class="question">
        <perch:label for="question4">How often do you do (at least 20 minutes) of exercise?</perch:label>
        <perch:input id="question4" type="radio" options="Never|1, Once or twice a month|2, Once or twice a week|3, Three times a week or more|4, About once a day|5" wrap="div.questionwrapper" />
    </div>

Just a small part of it but hopefully you get the idea.

If anyone has any suggestions on how I would go about this then I'd be grateful! If anything doesn't make sense I'll try and explain better.

Thanks, Martin

Martin Murphy

Martin Murphy 0 points

  • 4 years ago

Martin, I can only think of one solution, a custom app. It's a pretty simple one, basically I would add a hidden field to the form with a "trigger" score then add the custom app to the app attribute on the form, so the form first gets processed by perch forms then the custom app adds up the fields and if the score is same as trigger then send email. For multiple triggers you would just add additional hidden fields with this info.

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's possible with Perch forms, but not with the Forms app (the two are different). As Robert says, you need to build an app if you want to process the result from a form in a custom way.

Drew McLellan said:

It's possible with Perch forms...

Now that's something I didn't think is possible... so it's got me thinking now... would love just a quick explanation or tiny example if you get a free moment... thanks

Okay, I haven't yet built a custom app so I guess I'll need to look into that :)

If you get stuck remember there is the Registered Developers page where you can find many Developers who regularly build custom apps...

https://grabaperch.com/developers