Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Help with response validation?

I tried implementing this script, and I'm having some challenges as well. I'm wondering if someone can weigh in.

if(SSI_GetValue("expensive") > ([% accept%]))
strErrorMessage = "The expensive price must be higher than the bargain price";

No errors occur, but I tried to trigger the error and it doesn't work. Am I missing any other piece of code?

I've looked at the following posts for help, but I can't seem to trouble shoot around this.


asked Mar 31, 2016 by Oliver
I'll ask the obvious questions first.  Are these questions on different pages?  By the code I would assume that they are on different pages and the question named 'expensive' is on the page where you are placing this code and the question named 'accept' is on a previous page.  If not, that is the problem.  Are those the exact names of the questions, all in lower case?  That will also make a difference.

1 Answer

0 votes
I believe you put the wrong sign. Instead of greater its should be less than symbol only than it will show error message as you want to show message when expensive is less than acceptable.

Let me know if this help.
answered Apr 28, 2016 by Rajesh Rana Gold (24,715 points)
You could also just put "[% accept %]" in as the Minimum Value on the Settings tab for the numeric question "expensive". Then the software will do the validation for you.