Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form Validation: Added support for required fields #18

Merged
merged 2 commits into from
Feb 4, 2025

Conversation

natalialuzuriaga
Copy link
Contributor

Problem

Currently the form does not support required fields. There is an array called required containing all the fields in the schema that can be used to determined whether a field is mandatory or not.

Solution

Implemented required fields into the form by:

  • Created a new function called determineValidation that will create an object with validation information. It includes the logic for the determining if a field is required is done here. For any form validation we add onto in the future, all functionality will be made here.

validate object is then appended to the Form.io component to be returned.

Result

For required fields, the form will mark it as a required through a red asterisk. The submit button becomes enabled when all form fields are filled out.

Testing

Tested locally

Signed-off-by: Natalia Luzuriaga <[email protected]>
Copy link
Contributor

@decause-gov decause-gov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1 🚢 ✅

@natalialuzuriaga natalialuzuriaga merged commit 4bf93ac into main Feb 4, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants