Validate error: Cannot handle function 'selected'

Hi LN,

I have a problem with selected condition as you can see from the error below;
Error: ODK Validate Errors:

Something broke the parser. See above for a hint.
Error evaluating field 'data' (/data): The problem was located in Condition expression for /data
XPath evaluation: cannot handle function 'selected' requires 2 arguments. Only 1 provided.
Caused by: org.javarosa.xpath.XPathUnhandledException: The problem was located in Condition expression for /data
XPath evaluation: cannot handle function 'selected' requires 2 arguments. Only 1 provided.
... 10 more

The following files failed validation:
${EAJ_case_management_form}.xml

Result: Invalid
The form is herein attached. Please help me identify what is making it not work.
Fred_form.xlsx (34.9 KB)

Thanks,
Fred.

For the error you got... in the relevant column you need to check your syntax. See the docs on XLSForm relevant.
Most of yours are wrong. For example:
selected(${party_type}='alleged_perp')
should be either
selected(${party_type},'alleged_perp')
if party_type is a select_multiple type;
or
${party_type}='alleged_perp'
if party_type is a select_one type.


When checking the form on https://getodk.org/xlsform/ I noticed another error. In cell 65L {num_perp}, >0 needs to be ${num_perp} >0 (remove the comma).

Thank you @danbjoseph.

I appreciate your highlights. I had figured this out and corrected as necessary. The form is now working well.

Fred.

1 Like