Dynamic Intake Form
Table of Contents
Overview
Previously the webpages had to hard code logic in it's code behind to make sure we show and hide certain user inputs and fields depending on the inspection type. This logic was ugly and cumbersome as some inputs and fields were updated multiple times and inconsistently.
In order to remove the complexity and have a single source of truth, we redesigned the intake form logic. We've removed all the logic of manually setting fields visible and enabled, and move all that logic into the codelist. The base concept can be observed by looking at the p11_uc_IntakeFormNew page and the p11_codelist's lookupcategory value of DynamicField.
In the p11_uc_IntakeFormNew there are multiple fields for each row in the intake form. First being Business Owner, etc. You can also see that by default we hide every row, marking them as Visible=false. In doing so we start with a blank slate with every row hidden on the new intake form page. [Image 1: uc_IntakeFormNew]
To take this even further, every field has been programmatically hid and every validator disabled in the code behind. This happens in the sub_Initialize_IntakeForm() function. [Image 2: sub_Initialize_IntakeForm]
Dynamic Fields
In the codelist for DynamicField, we store the name of the field in LookupTitle, the associated required field validator in Option2 and the inspectiontypeno in Option7. The screenshot above is the fields that should display for Facets Structure.
In the sub_Initialize_DynamicFields() function, we call the p11_Get_DynamicFields stored procedure, which grabs all the DynamicField values shown above.
Then using these values, we show only the relevant fields and enable the correct required field validators. [Image 3: DynamicField]
Dynamic Options
For radio buttons and checkboxes, we load them using the sub_Initialize_DynamicOptions() function. In this function we call sub_Load_List(), which adds the list items into the radio button list or checkbox list using the stored procedure p11_Get_DynamicOptions.
We use Option1 to specify the actual lookup number for that category stored in LookupTitle. In this case the two Specialty values we want to display for Facets Structure are 1 and 10. This can be looked up further in the codelist table where lookupcategory = ‘Specialty'. The Option2 value sets whether that option should be selected by default or not. In the case of Specialty, it will default to N/A. [Image 4: DynamicOption]
NOTE: BO's can create Intake Forms with Inspection Types:
- CIT (1)
- ePro (2)
- Benefit (4)
QM's and Back Up QM's can create Intake Forms with Inspection Types:
- Facets Structure (3)
- Facets Contracts (5)
- Facets Booklets (6)
- Facets Rate (7)
- Non Facets Contracts (8)
QR's AKA Gate keepers can create Intake Forms with Inspection Types:
- Proclaim (9)
NOTE: QM's and Back Up QM's can only assign auditors that are on the same team and Only above role types (BO, QA, QM, Back Up QM) can create Intake Forms.