Bug: Making Race a required field prevents the create new patient from saving

tmccormi wrote on Friday, October 23, 2015:

Just what it says. Tested on the open-emr.org 4.2.0 demo
Made Race Required then you can’t create a new patient.

When you press Save
Javascript console says: Uncaught TypeError: Cannot read property ‘selectedIndex’ of undefined

–Tony

bradymiller wrote on Friday, October 23, 2015:

Terry reported this here also:
https://sourceforge.net/p/openemr/bugs/399/

We discussed this at the conference call and guessing it’s related to the multiselect feature of that item. I am guessing the fix won’t be tough.

-brady
OpenEMR

yehster wrote on Friday, October 23, 2015:

Proposed Fix

yehster wrote on Friday, October 23, 2015:

I wouldn’t have characterized the fix as “easy”.

There’s some javascript quirkiness with the multi select elements having “[]” in the name, which is why elementByID is used in the proposed fix to access the object instead of f.$fldname

fsgl wrote on Friday, October 23, 2015:

Low tech workaround:

  1. Keep UOR as optional.
  2. Set in Lists/Race as default that which is the majority in a particular practice. For minorities, physician will have to remember to use drop down menu, otherwise AMC report will be a reminder.

Saves a bit of clicking while creating new accounts.

tmccormi wrote on Friday, October 23, 2015:

fsgl - This is a free student clinic at a University in south Texas. There is not default average race and they have requirements for reporting unrelated to MU. So they really need to make it required for the student staff.

fsgl wrote on Friday, October 23, 2015:

Since the university has not been named, difficult to look up racial mix.

Had it been Texas Southern University or Howard, Black would be the logical guess for the default.

One can also insert into Patient Summary a flashing reminder (like Active Alert) or big, bold red text that Race must be addressed.

If it doesn’t suit, then it does not.

aethelwulffe wrote on Friday, October 23, 2015:

http://sourceforge.net/p/openemr/discussion/202506/thread/9c0840ea/
and in bug tickets on sf and GH
Reported this myself in a few places.
Fix = removal of all that and the religion thing.

yehster wrote on Monday, October 26, 2015:

Further revision to initial commit.

In addition to not handling required multiselects properly, the validation code was also not escaping the Field Titles properly for other required fields.

To demonstrate this, change the title of DOB to DOB\ (with the backslash) in the name then comeback to the new/create patient screen. Javascript console will show an unterminated string literal error, and the save button will fail.

Switching to addslashes rather than htmlspecialcharacters correct this.

Because these strings are javscript literals they need to be handled this in this manner.

Refer to Step 4 exceptions in this document for further details.

http://www.open-emr.org/wiki/index.php/Codebase_Security#Implementation

yehster wrote on Saturday, November 07, 2015:

Committed to the official code base now after final revisions.

http://sourceforge.net/p/openemr/code/ci/90d105a77cc964d7bbc2b8c6d6bc1c25cefca2f0/