Description
The current questionnaire page needs to be updated to support advanced field properties found in our REDCap-based JSON format. Specifically, we need to implement logic for field requirement toggles, numeric input formatting, and range validation (min/max).
Proposed Changes
1. Support for Required Fields
Implement logic to respect the required_field attribute.
- Attribute: "required_field": "y" (Required) or "" (Optional).
- Action: If set to "y", the Next button should not be enabled unless filled.
2. Numeric Text Formatting (#1391)
Enable specific input types for text fields based on validation metadata.
- Attribute: "text_validation_type_or_show_slider_number": "number"
- Action: When this is set to "number", the input field should restrict entry to numeric values and potentially trigger the numeric keypad on mobile devices.
3. Range Validation (Min/Max)
Add logic to validate numeric inputs against defined boundaries.
- Attributes: text_validation_min and text_validation_max
- Action: Only allow numbers within the range, throw a validation error if the input falls outside the range (e.g., “Value must be between [min] and [max]”).
Technical Context
The updates should target the processing of the following JSON structure:
JSON
{
"field_name": "meduse_2b_1",
"field_type": "text",
"required_field": "y",
"text_validation_type_or_show_slider_number": "number",
"text_validation_min": "0",
"text_validation_max": "500"
}
Acceptance Criteria
Description
The current questionnaire page needs to be updated to support advanced field properties found in our REDCap-based JSON format. Specifically, we need to implement logic for field requirement toggles, numeric input formatting, and range validation (min/max).
Proposed Changes
1. Support for Required Fields
Implement logic to respect the required_field attribute.
2. Numeric Text Formatting (#1391)
Enable specific input types for text fields based on validation metadata.
3. Range Validation (Min/Max)
Add logic to validate numeric inputs against defined boundaries.
Technical Context
The updates should target the processing of the following JSON structure:
JSON
Acceptance Criteria