Skip to main content
Kinetic Community

Retrieve an Answer - With Escape Characters

How to Retrieve an Answer and use it in your Fire Event If when the Answer contains double quotes.

Usage

In this situation I only want to Fire my Set Fields Internal when the Answer to my List Question is "How to" and the Answer to my List2 Question is Yes.  Because my List Question Answer contains double quotes I need to Escape the double quotes in order for the javascript function to process it correctly.  In order to accomplish this I need to include the escape character which is a \ before each double quote.  However, I also need to escape the escape character meaning I need to include the escape characters before the escape character.  As this is a little confusing I have attached a Service Item that contains this functionality.

Example

The attached Service Item contains three questions:

List - "How to" and Yes are the possible Answers

List2 - Yes and No are the possible Answers

Set Me - This question is Set if List is populated with "How to" and List2 is populated with Yes

Because the List question contains characters that need to be escaped the Fire Event if on the List2 question is set to the following:

obj.value== "Yes" && KD.utils.Action.getQuestionValue("List") == "\\\"How to\\\""

Because "end users" can get a little "Click Happy" I have also built Events that will Set the Set Me question to a NULL value if "How to" isn't populated into the List Question and if Yes isn't populated into List2.  Also because of the Click Happy end users I have built a similar Event on the List question to ensure that the Set Me question is always populated correctly.  The Fire Event if on the List question is set to the following:

obj.value== "\\\"How to\\\"" && KD.utils.Action.getQuestionValue("List2") == "Yes"