NPE for patient Identifier type when not required in HTML form

This is how I am using it in my form

<patient field="identifier" identifierTypeId="2" required="false"/>

When I submit I get such exceptions.

Caused by: java.lang.NumberFormatException: null
        at java.lang.Integer.parseInt(Unknown Source)
        at java.lang.Integer.<init>(Unknown Source)
        at org.openmrs.module.htmlformentry.element.PatientDetailSubmissionElement.getIdentifierType(PatientDetailSubmissionElement.java:448)
        at org.openmrs.module.htmlformentry.element.PatientDetailSubmissionElement.handleSubmission(PatientDetailSubmissionElement.java:352)
        at org.openmrs.module.htmlformentry.FormSubmissionController.handleFormSubmission(FormSubmissionController.java:128)
        at org.openmrs.module.htmlformentryui.fragment.controller.htmlform.EnterHtmlFormFragmentController.submit(EnterHtmlFormFragmentController.java:222)
        ... 70 more

@slubwama What is the question to your problem that you want help on?

1 Like

These attributes in this patient tag still seems to throw this NPE error because am getting

For input string: “”

as my error. I suspected it may be due to the predefined regEx but iam not sure since the identifierType being used doesnt seem to have any regEx defined when i checked via the legacy UI.

The question is why this error pops up when I enter a value as the Identifier(even if i insert a number since this appears to be an issue of conversion from string to int)? Could it be that the value is meant to be autopopulated after having been inserted from some other ui rather than the form? cc @mogoodrich @dkayiwa @mksd @samuel34

Are you able to reproduce it here? https://qa-refapp.openmrs.org/