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

Substring containing < followed by an alphabetic character will not be displayed in the Query Widget history #27

Open
eprager412 opened this issue Nov 1, 2023 · 4 comments
Assignees
Milestone

Comments

@eprager412
Copy link

eprager412 commented Nov 1, 2023

Describe the bug
Text "<letter" displays null instead of "<letter" when viewing query, annotation, or reason for change in the Query Widget.

To Reproduce
---Annotations & Query----

  1. Open attached form in mode /edit/fs/c/i/
    simplequery.xform.txt
  2. Add a query or annotation to the "Date" question with the text string "<e".
  3. Review query within record
  4. Query will display as empty

If the text entered had been "some text <e", then the query display will be "some text". Everything starting with the first "<" is not displayed. The same occurs when reopening the form with an instance containing this query string. Note that the instance represents the "<" character as "<".

----Reason for Change----

  1. Open attached form in mode /edit/fs/c/i/
  2. Add todays date for question "Date".
  3. Submit record
  4. After submit change date from today to yesterday for question "Date"
  5. Add Reason for change "<e"
  6. Review audit log for item "Date" within the record
  7. Reason for change value will display as empty

Expected behavior
Value displayed within record matches the value that the user entered for the query, annotation, or reason for change (including the "<" and characters after it.

Screenshots

2023-11-01_16-27-12
2023-11-01_16-34-13

Browser and OS (please complete the following information):

  • Chrome,

Other helpful info:
There are no errors in the network tab when submitting or reviewing a query. The data entered for a query can be viewed in other areas of the system.

@eprager412 eprager412 changed the title String containing < followed by an alphabetic character will display no text value when viewed within record String containing < followed by an alphabetic character will display no text value when saved and then viewed within record Nov 1, 2023
@pbowen-oc pbowen-oc added this to the Next milestone Nov 1, 2023
@pbowen-oc pbowen-oc changed the title String containing < followed by an alphabetic character will display no text value when saved and then viewed within record Substring containing < followed by an alphabetic character will not be displayed in the Query Widget history Nov 1, 2023
@MartijnR
Copy link
Member

MartijnR commented Nov 2, 2023

curl --user enketorules: -d \
"server_url=http://localhost:3000&form_id=language.test&ecid=a&lang=de&instance=\
<data xmlns:OpenClinica= \"http://openclinica.com/odm\" xmlns:enk= \"http://enketo.org/xforms\" xmlns:jr= \"http://openrosa.org/javarosa\" xmlns:oc= \"http://openclinica.org/xforms\" xmlns:orx= \"http://openrosa.org/xforms\" id= \"language.test\" version= \"1\">\
    <page1>\
        <locale_note />\
        <yn1 />\
        <locale_note_comment oc:queryParent= \"locale_note\" />\
        <yn1_comment oc:queryParent= \"yn1\">\
    {\"queries\":[{\"type\":\"comment\",\"id\":\"1\",\"date_time\":\"2023-01-18T11:34:36.608-05:00\",\"comment\":\"four %26lt%3Bfive -%26amp%3B%20%26gt%3B%20%26lt%3B\",\"status\":\"new\",\"assigned_to\":\"\",\"notify\":false,\"thread_id\":\"50b52cae-6c5b-4d1a-ab70-3e05b31e3784\"}]}</yn1_comment>\
    </page1>\
<meta>\
        <instanceID>uuid:e1623dbf-bf87-4b2a-8a5a-85ae832f31f3</instanceID>\
    </meta></data>\
&instance_id=123" http://localhost:8005/oc/api/v1/instance/edit

The challenge with reproducing was not realizing that we need to 'entity-encode' (for curl) the 'xml-encoded' content, so < becomes %26lt%3B.

@MartijnR
Copy link
Member

MartijnR commented Nov 2, 2023

@eprager412 @pbowen-oc Could you please post the content of the instance sent to Enketo (a response to a request to /submission), such as below?

Screenshot 2023-11-02 at 3 49 51 PM

@pbowen-oc
Copy link

pbowen-oc commented Nov 3, 2023

@MartijnR - This is visible on the form without reopening it.

Enter new query text:
Screenshot 2023-11-02 212154

After updating the query:
Screenshot 2023-11-02 212227

The other query in that screenshot is coming from the instance:
It was entered as "test1 <test0"
query less than.instance.txt

@pbowen-oc
Copy link

@MartijnR - Sorry for the confusion. The endpoint was incorrect in the original description. This issue occurs with the standard new form or existing form field submission endpoints. I changed it above to reflect that it occurs in /edit/fs/c/i/.

MartijnR referenced this issue in OpenClinica/enketo-express-oc Nov 15, 2023
kkrumlian referenced this issue in OpenClinica/enketo-express-oc Nov 15, 2023
@MartijnR MartijnR transferred this issue from OpenClinica/enketo-express-oc May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants