Validation to Custom Script

0

Hi,

Can I add currency validation to a custom script and/or a hidden value?

I’m having an issue that some of my questions have a currency validation on them, but my custom script and subsequent hidden values are not picking up the currency validation and only returning a number?

Thanks,

Tony

IS answered
    0
    IS 2.20K Rep.

    If I understand you correctly, the problem is that the default value for (d) is not being shown as a currency value?

    The default value will be whatever is stored in your hidden value field (c). Hidden Values are all strings. You may just want to use the php function money_format ( http://php.net/manual/en/function.money-format.php ) to convert your total before storing it in your hidden value field. Something like:

    %%currencytotal = money_format(‘%.2n’, %%total);

    Note that this forum converts straight quotes to left- and right-quotes which won’t work in your code. If you copy and paste my example code, you will need to replace the quote characters.

    Does that help?

    IS answered
      0

      I also have this question. I want to subtract one currency value from another and display the total using custom scripting. When I use number format it works fine, but when I switch to currency “0” is returned. Is there a workaround to this?

      baldwiaj answered
        0

        Hi,

        Not sure, I have the following;

        (a) I have a continuous sum question (currency).

        (b) Then a custom script to get the total of (a).

        (c) Then a hidden value to store (b).

        (d) Then a number question (currency).

        My problem is;

        (d) has a default answer of (c) and all works fine, however (d) is not showing as a currency.

        Not sure if I’ve explained that ok….

         

        tonymccready answered
          0

          Hi Tom,

          Could you please clarify – are you trying to validate hidden values, or do you want to format them as currency?  And how are you using these hidden values with your survey?

          Jim W (Moderator) answered
            ×

            Login

            Question stats

            • Active
            • Views1343 times
            • Answers4 answers
            • Followers1 follower