Calculate the total price based on the number of participants

  • lauredc70
    Demandé le 22 avril 2024 à 08:04

    Bonjour,

    je souhaite créer un formulaire avec

    1/ choix du nombre de participants

    2/ inscription nom/prénom des participants

    2/ en fonction du nombre de participants choisis le total au paiement correspond au nombre de participants (saisis plus haut dans le formulaire) x prix, et cela sans avoir à rechoisir dans le panier le nombre de participants

    J'ai crée un formulaire PAF cousinade ici

    et je ne trouve pas le moyen de relier le nombre de participants avec le montant total du paiement.

    Avez-vous une idée ?

    Merci


  • Joseph Christian Jotform Support
    Répondu le 22 avril 2024 à 10:32

    Hi lauredc70,

    Thanks for reaching out to Jotform Support. Unfortunately, our French Support agents are busy helping other Jotform users at the moment. I'll try to help you in English using Google Translate, but you can reply in whichever language you feel comfortable using. Or, if you'd rather have support in French, let us know and we can have them do that. But, keep in mind that you'd have to wait until they're available again.

    Now, coming back to your question, you can do this by adding a Form Calculation widget to your form and passing the calculation to the payment field. Let me show you how:

    • In Form Builder, click the Add Form Element on the left side of the page.
    • Under the Widgets tab, search for Form Calculation Widget and add it to your form.

    Calculate the total price based on the number of participants Image 1 Screenshot 50Then, add the calculation to the Form Calculation widget. Check out the steps and screencast below to see how it's done:

    Calculate the total price based on the number of participants Image 2 Screenshot 61 Now, let's change the Payment Type of the Stripe Integration from Sell Products to User Defined Amount so we have an option to capture the total from the Form Calculation widget. Here's how:

    • Select your payment field, and click on the Wand icon to open Payment Settings.
    • Change the Payment Type to User Defined Amount.
    • On the Get Price From dropdown, select the Form Calculation Widget field (Total: in my example)
    • Click Save to apply the changes.

    Calculate the total price based on the number of participants Image 3 Screenshot 72 Here's my result:

    Calculate the total price based on the number of participants Image 4 Screenshot 83

    You can also clone my cloned form here.

    Let us know if you have any other questions.

  • lauredc70
    Répondu le 22 avril 2024 à 12:27

    Thank you so much for your answer and your help. It works fine and helps me a lot.

    Actually I've got another question :

    I would like to display the number of fields to enter depending on the number of people expected. So if 2 people are present only 2 fields "Please enter the first and last names of participants over 10 years old" will not be offered more. And if 5 is selected, 5 fields will be dynamically proposed. Is it possible ?

    Thank you for your help

  • Joseph Christian Jotform Support
    Répondu le 22 avril 2024 à 13:31

    Hi lauredc70,

    Thanks for getting back to us. Unfortunately, we can't conditionally update the Dynamic Textbox widget fields based on the value entered in another field. However, you can do the other way around which is to let your users enter the participants' names first, then pass the total number of participants to a form calculation widget. Let me show you how:

    1. In Form Builder, click the Add Form Element on the left side of the page.

    2. Under the Widgets tab, search for Form Calculation Widget and add it to your form.

    3. You can also set this to hidden if you don't want your users to see this.

    Calculate the total price based on the number of participants Image 1 Screenshot 604. Then, select your dynamic textbox by clicking on the wand icon to open Widget settings.

    5. Set the Count textboxes? to Yes.

    Calculate the total price based on the number of participants Image 2 Screenshot 716. Once that done, select the new form calculation widget that you've added by clicking the wand icon to open widget settings.

    7. Add the Dynamic Textbox field to the formula by clicking on the Add Field button.

    8. Click Save to apply the changes.

    Calculate the total price based on the number of participants Image 3 Screenshot 82 Then you can update the formula on the initial Form Calculation widget that you've added previously to get the total amount of price. Set the new formula like you see below:

    Calculate the total price based on the number of participants Image 4 Screenshot 93Checkout the screencast below to see my results:

    Calculate the total price based on the number of participants Image 5 Screenshot 104 That's it. If you'd prefer to let the users input the number first and then show the corresponding number of participant fields then, I'm afraid, you would need to use multiple short text fields instead of the Dynamic Textbox widget. Use conditional logic to show/hide the short text fields based on the user's input value.

    Give it a try and let us know how it goes.

  • lauredc70
    Répondu le 24 avril 2024 à 04:25

    Hello,

    and thank you for your answer. It helps me a lot and your explanation is very clear.

    However, there seems to be a bug. Hidden fields appear on the form.

    The total one and the invoice.

    Thank you

  • Israel Jotform Support
    Répondu le 24 avril 2024 à 06:27

    Hi lauredc70,

    Thanks for getting back to us. It would help us to understand what’s happening if you could take a screenshot and send it to us. We have a guide here explaining how to do that.

    Once we hear back from you, we'll be able to help you with this

  • lauredc70
    Répondu le 24 avril 2024 à 06:36

    Yes of course here are the screenshots


    Total hidden field on form buider

    Calculate the total price based on the number of participants Image 1 Screenshot 50 Screenshot 10


    Result on form for Total field

    Calculate the total price based on the number of participants Image 2 Screenshot 61 Screenshot 21

    The same for Invoice field

    Calculate the total price based on the number of participants Image 3 Screenshot 72 Screenshot 32

    Calculate the total price based on the number of participants Image 4 Screenshot 83 Screenshot 43

    Thank you


  • Victorino_S Jotform Support
    Répondu le 24 avril 2024 à 08:54

    Hi Laure,

    Thanks for getting back to us. As for your other question, I've moved that to a new thread. You can check that out here.

 
Votre Réponse