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?
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?
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?
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….
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?