What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.

  • Profile Image

    Conditional logic and PayPal product selection

    Asked by LS_Launch on May 11, 2017 at 11:45 AM

    Hi, I noticed in 2012 someone was trying to do something I am trying to do. You were able to help him by embedding a script into his form. I'm wondering if you can help me out in a similar way. When my user gets to my PayPal widget, it is up to him to choose the PayPal products he said he was going to choose in the form. What I am looking for is a way to force the PayPal product selection to match his selections in the form... to remove his ability to not pay for what he says he is going to purchase. Could you help me with this?

    Form Name: Packing Party Tickets


    If user selects "Buy my Own Ticket or Redeem a Gift Ticket" on question=What do you want to do?, then force select "Graduate Ticket $15" product in the PayPal widget If that same user then selects "yes" for question=Will your mother attend with you for an additional $10?, then add "Mother Ticket $10" to the product selection. So, this user would have two products selected. (If the user selects "no" for that question, nothing needs to happen.) If user selects "Buy Gift Ticket for someone else" on question=What do you want to do?, then select "Gift Tickets $15" and use the number entered for question=Number of Tickets you want to purchase to fill in the quantity. Also, I would like the user to not be able to change the answers on that page. I want them completely forced by what they enter in the body of the form.

    Given all that you know I am trying to do, is there a better way to employ the PayPal widget than using Products? 

    Thanks for the help!


  • Profile Image
    JotForm Support

    Answered by Nik_C on May 11, 2017 at 01:24 PM

    So the issue basically is that your users select what they want to buy on the first page and you want to be sure that they will choose the product on the payment page

    Just clarify please, if the first option is selected (first screenshot) what should be selected in the second screenshot?

    And just for your information, it is not allowed to insert script code to the form because of the security issues.

    But, if you need what I described above, it is doable with conditions and some other changes, just confirm, what should be selected in payment when "What do you want to do" is selected, for each option.

    We'll wait for your response.

    Thank you!

  • Profile Image

    Answered by LS_Launch on May 11, 2017 at 01:44 PM
    Thanks for the quick response, Nik_C. I tried to figure this out with conditions, not sure what I missed. So, Thanks for helping me out! I will try to explain my conditions well. Hopefully I’m successful :)
    To answer your question below:
    If the first option (Buy my Own Ticket…) is selected on first screenshot, then, I’d like the First product (Graduate Ticket $15) selected on the second screenshot.
    If the second option (Buy Gift Ticket…) is selected on the first screenshot, then I’d like the Third product (Gift Tickets $15) selected on the second screenshot.
    I have two more conditions, though…
    When “Buy my own ticket" is selected on the first screenshot, at some point later, the user will identify whether or not her mother will be attending with her.
    If she chooses “no”, nothing needs to happen, but if she chooses “yes”, the Second product (Mother Ticket $10) needs to be checked on your second screenshot.
    When “Buy Gift Ticket” is selected on your first screenshot, the user will eventually be identifying how many tickets.
    This number needs to go into the Quantity box below “Gift Tickets” on the second screenshot.
    Does this all make sense? Again, thank you for your help. This is a really powerful tool you have. I do a lot of work for non-profit organizations and used to rely heavily on Google Forms. JotForms is SOOO much better. Love it!
  • Profile Image
    JotForm Support

    Answered by Nik_C on May 11, 2017 at 02:19 PM

    Thank you for an explanation. It is helpful. I would say it is doable, but let me check this more and I'll get back to you as soon as I finish.

    Thank you!

  • Profile Image

    Answered by LS_Launch on May 11, 2017 at 02:44 PM
    Great! Thanks, Nik_C!
  • Profile Image
    JotForm Support

    Answered by Nik_C on May 11, 2017 at 02:52 PM

    Ok, I think I got it.

    I clone your form and did some changes there. First I created your products by using the regular radio buttons and assigned calculation values to them so we can use it for the price:

    Then I created conditions that will select each radio button option (product) when the conditions are met, what you described above.

    Here are conditions for each situation:

    If only second option is chosen:

    The first option is chosen plus mother selection selected to No:

    The first option is chosen but mother option selected to Yes:

    So with each option, appropriate radio button will be selected.

    Now we need to calculate the price, I added one Form calculations widget:

    And I added one number field (Gift tickets Quantity) that we can use for Quantity for Gift tickets option.

    Here are the conditions that will do the calculations:

    If the third product is selected it will be multiplied with Quantity field.

    Finally the price from product calculations field we can pass to payment field:

    What I would do additionally, I would make product radio button options read-only, so they can not change that. And you can hide the product calculation field since the price will be shown any way in the payment field.

    Here is my clone of your form so you can check how it works:


    Hope that is what you had in mind. Please check and let us know your thoughts.

    Thank you!

  • Profile Image

    Answered by LS_Launch on May 11, 2017 at 05:43 PM
    Great! I edited my form to mimic yours… and I learned a couple things in the process :)
    Have a great day!