Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing values with double-quotes to harness inputs crashes enketo #136

Open
derickl opened this issue Sep 9, 2021 · 0 comments
Open

Passing values with double-quotes to harness inputs crashes enketo #136

derickl opened this issue Sep 9, 2021 · 0 comments

Comments

@derickl
Copy link
Member

derickl commented Sep 9, 2021

Assuming you have a question name and a calculate household_name that concatenates name with Household, the expression would fail to evaluate if name had a " character as part of its input.

The following failure is in both cht-core and harness.

Could not evaluate: concat(../../contact/name, ' Household'), message: Failed to execute 'evaluate' on 'Document': The string 'concat("He A"", " Household")' is not a valid XPath expression.

This is a limitation of XPath 1.0 which does not provide a way of quoting double-quotes. Newer XPath standards support this but unfortunately most (if not all) browsers support XPath 1.0

Additional information:

REF branch

What happened?

Register household members with name, Je"n Claude, should throw a validation error:
     Error: Evaluation failed: FormLogicError
      at ExecutionContext._evaluateInternal (node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)

What did you expect?

Error encountered while filling form: [
    ✓ Register household members with name, Je"n Claude, should throw a validation error (...ms)
  {
    "type": "validation",
    "question": "Name*\nName should not contain integer or non-alphanumeric characters",
    "msg": "Name should not contain integer or non-alphanumeric characters"
  }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant