Skip to main content

Cannot click drop-down answer values with apostrophe in Information Extraction

The steps below describe the circumstances how the issue occurs:

  1. When designing a Manual Task, create a Select One answer where the value includes an apostrophe.

  2. Add a sub-answer with the expand:on() CSS rule.

  3. Run the task and open its preview.

  4. Try to select the value with an apostrophe. It is impossible to select the value. In the console, you see the following error:

    jquery.min.js:2 Uncaught Error: Syntax error, unrecognized expression: :regex(class, expand:on\(value'1\))
    at Function.nt.error (VM1427 jquery.min.js:2)
    at ut (VM1427 jquery.min.js:2)
    at vt (VM1427 jquery.min.js:2)
    at Function.nt [as find] (VM1427 jquery.min.js:2)
    at init.find (VM1427 jquery.min.js:2)
    at HTMLOptionElement.<anonymous> (<anonymous>:255:71)
    at Function.each (VM1427 jquery.min.js:2)
    at init.each (VM1427 jquery.min.js:2)
    at expandCollapseNested (<anonymous>:252:35)
    at HTMLSelectElement.<anonymous> (<anonymous>:265:54)

Cause

You cannot click a drop-down answer value with an apostrophe if it is a parent answer with the expand:on functionality.

Resolution

To resolve the issue, follow the instruction below:

  1. In Control Tower, go to Advanced > Templates.

  2. Find and open the html.ftl file.

  3. Find the function and replace it with the following:

    function escapeRegExp(str) {
    return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|\']/g, "\\$&");
    }