Uploaded image for project: 'Chart Search Module'
  1. Chart Search Module
  2. CSM-127

Javascript Error when an observation text contains a carriage return (CHAR13)

    XMLWordPrintable

Details

    Description

      If a text observation contains a carriage return (Enter key), then the Chart Search page won't fully load and return a JavaScript "Unexpected token error"

      Steps to reproduce:

      1/ Log in http://demo.openmrs.org/openmrs
      2/ Go on a patient page and add a Visit Note encounter
      3/ On the Visit Note, enter a Diagnosis (anything)
      4/ As a Clinical Note, enter the following text:
      word1
      word2

      Note the carriage return (press Enter) that separates the 2 words.

      5/ Now save the form
      6/ Navigate to Chart Search and notice that the page doesn't load fully. See the many JavaScript errors.

      This seems to be an escaping error, where the carriage return character is not handled correctly.

      Some other useful information:
      Note that if you try to remove the faulty character (for instance replace
      word1
      word2
      by
      word1word2) then you'll have to clear the index for this patient (http://demo.openmrs.org/openmrs/module/chartsearch/commands.form) and reload the Chart Search page to see your changes.

      https://talk.openmrs.org/t/chart-search-nullpointerexception-when-loading-a-patient-with-simple-text-observation/9398/9

      Gliffy Diagrams

        Attachments

          1. clear index.png
            clear index.png
            26 kB
          2. click-CS.png
            click-CS.png
            34 kB
          3. empty result search.png
            empty result search.png
            30 kB
          4. encephalocele.png
            encephalocele.png
            50 kB
          5. no results on search.png
            no results on search.png
            13 kB
          6. note and diag.png
            note and diag.png
            39 kB
          7. Screenshot from 2016-01-27_02.png
            Screenshot from 2016-01-27_02.png
            34 kB
          8. search note.png
            search note.png
            41 kB
          9. search note after crash.png
            search note after crash.png
            31 kB
          10. two lines clinical note.png
            two lines clinical note.png
            9 kB

          Activity

            People

              dkayiwa Daniel Kayiwa
              mksrom Romain Buisson
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 2 hours
                  2h
                  Remaining:
                  Remaining Estimate - 2 hours
                  2h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified