Sorry for the delay in looking over your patch.
It looks good overall. I only have two suggestions:
- elementFormats in the xml would make more sense named "regexExample" or "formatExample".
- The overriding of removeBlankData() in addressLayout.jsp is kind of hacky. There are all kinds of separation of control rules broken.
Making patientForm more extendable seems like the right path. I can only think of two possible solutions:
- Put a general continueSubmit var in patientForm and make the form tag have onSubmit="removeBlankData(); return continueSubmit". AddressLayout.jsp could then just manipulate the continueSubmit var as necessary.
- Make the patientForm form tag be onSubmit="removeBlankData()". In addressLayout.jsp, programmatically add a validation method to the containing form.onsubmit.
If left as is, there are several weaknesses: 1) patientForm is changed and the overridden method in addressLayout is not would cause problems. 2) if addresslayout is used in another form, it won't prevent submission.
Address Regex Patch