Have an idea?

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

How to validate textbox for special characters ?


I am trying to implement the javascript in SSI 7 to validate the respondent answer when he/she enters a special characterlike ";" , "," , "/", "\" etc .
asked Dec 1, 2011 by anonymous

1 Answer

0 votes
Best answer
You can use regular expressions in JavaScript to check a respondent's answer for any of the above characters. For example, if you want to display an error every time a special character is entered you could use some custom JavaScript verification such as

var answer = SSI_GetValue("QuestionName");

if (answer.match(/[;,\/\\]/)) {

  strErrorMessage="Please revise your answer";

answered Dec 1, 2011 by Jeff Forkner Bronze (2,875 points)