Form Calculations

  • Profile Image
    Asked on March 16, 2011 at 11:43 AM

    I would like to create a PayPal form that calculates a total, based on the muber of days a person registers for a rental property.  Is this possible?


    In other words, they put in the dates they would like on the calendar, it calculates the the number of nights, then comes up with an amount for PayPal.


    For example, if I want to stay from Oct 1st to and depart October 16, that is 15 nights. Let's say the price per day is 100 per day or $1500. If I stay for 5 days, the price is $110 per day or $550.


    If the form can't do it, is there a way for me to pass this number/variable/calculation from an external source to the form?




  • Profile Image
    Answered on March 16, 2011 at 12:42 PM

    Hi Steve,

    Sorry but there is no way to include extra logic in the form other than downloading the full source and modifying the javascript yourself.  However you could set up a page to do the calculation and then pass that value into the form.  To do that you'd need to:

    1. Set up your own page which does the calculation.

    2. Forward the user to the form, passing the calculated value along with the url.

    See this post on how to do that

    You would need to set the payment up as a donation since it's the only type with a text input and you may also need to remove the validation on the field (so you'll need to download the full source).  It is a bit of a hack I'm afraid. 

    Have you thought about using conditions?  If you split the form into two stages then you could send the user to to a specific payment form based on the their response in a form at the first stage.