Hospital online forms
Due a circumstances outside our control, my son needed to be admitted into a hospital for a day surgery procedure. Since this was the first time I have had to deal with a hospital admission myself, I was curious to see how the admission process would work. Thankfully this hospital has an online admission form which is meant to save you from tedious paperwork. The starting page looks like this
Stock standard starting form I imagine, meant to see if you already have details that they could leverage in order to prevent you having to fill more things in! It was all well and good till I got to the birth date field.
My son was born last year. I could not enter that date without throwing validation errors. At all! Nothing I tried would work. First of all, the drop-down had marked that month as disabled.
Even if I tried to enter that date by hand, it was marked disabled,
but if I chose a date that was before 1 year from now, that worked.
So clearly, the validation would not allow you to enter a date that was now minus 1 year
.
But how to fix that!!! I am somewhat familiar with online form validations and JavaScript, so I decided to see what was actually happening. Looking in browser developer console, I had a look at what JavaScript files were being loaded. Slowly iterating via them one by one, I ended up on this file!
This file was interesting because the corresponding contents showed there was a schema being loaded somewhere which set the min data and max date for that form. Since there was only one date field on the form, it was logical to believe that this was what was preventing me from entering the proper birth date.
Correspondingly, inspecting the date element itself showed the relation to the schema’s min and max date.
And to confirm, my suspicions, I put a break point on the above mentioned JavaScript file and reloaded the page. and then checked the value of the schema min and max date in the console.
As you can see, the whatever the schema was, was setting the maxDate
to current time minus a year. I logged the minDate
just to see what the back limit was. Its quite interesting to see that this hospital does not expect to treat anyone older than 120 years or younger than a year!
At this point, I am getting frustrated with my repeated attempts to fill the form so I tried to see if at the instance of break point activation, I could override the maxDate
. Turns out that I could.
Since I could override it, I set it to the appropriate limit and managed to enter the DOB of my son. And it worked.
I am just wondering how annoying it must be for someone who is not used to doing the above in their day to day lives! Also makes me wonder about the requirements given to the form developers and their associated QA process.
Note: All Dates have been changed