[Solved] Multiplying a field response by a constant number to work out a total fee owed

0

Hi

I’m looking at this functionality:

http://script.surveygizmo.com/help/article/link/working-example-user-defined-functions

But wondering how to adapt it for my situation where I have a standard charge per day ($40) and I want the user to enter the number of days they’ll be using the car park, then have the form multiply it into a total that they owe.

The example given multiples 2 fields that users enter, whereas I want to multiply 1 field by a standard charge.

Cheers

 

Jane

Jane Hadaway187251 asked

    Best answer

    1

    Hi Jane,

     

    The answer to your question depends on exactly what you are trying to do! It seems as if you don’t actually need a function in this case as your math should be pretty simple.

    Take a look at this short and simple script I wrote:

     

    %%days = sgapiGetValue(20);

    %%price = %%days * 40;

    %%output .= %%price;

     

    This will return whatever number of days is entered in a textbox with the ID of 20, and multiply it by 40, giving us the amount that should be charged to the respondent.

     

    However, all this script will do is print this number to the screen. If you actually want to collect payment in your survey, you may want to check out this cool document: http://help.surveygizmo.com/help/article/link/payment-form#create-a-payment-form

     

    If you know a minimum and maximum number of days, you may want to just create a dropdown or radio button question for the respondent to select the number of days. Then the stripe integration will calculate their total, and ask the respondent for payment at the end of the survey.

     

    Hopefully this helps a little!

     

     

    Thanks,

     

    Cliff

    Cliff McGrupp answered
      1

      Hey Jane,

      Do you think you could use that script and then alter your survey to fit it? I think if you were to have a question where the respondent enters the number of days they’ll use the car park and then have a question that has a default answer of “40”. If you put “sg-hide” into the CSS Class Name field of this question, respondents won’t even see it. By doing this, you might be able to use that script.

       

      Robert

      Robert Hamlsey answered
        ×

        Login

        Question stats

        • Active
        • Views529 times
        • Answers2 answers
        • Followers0 followers