Skip to content

Add postal code to Person #13

Description

@Japoivvb

Describe the solution you'd like
Currently, the "Person" model does not have a postal code field or validation. To improve the model, we should:

  • Add a new postalCode field to the "Person" model.
  • Implement regex validation to ensure the postal code is in the correct format.
  • Update the user interface to handle postal code input and validation when adding or updating a person.

Additional context

  • Postal Code Field:

Add a postalCode attribute to the "Person" class with the necessary getter and setter methods.

  • Regex Validation:

Use a regex pattern to validate the postal code format. For example, for a typical US postal code format:
String postalCodeRegex = "^(\d{5})(?:[-\s]?\d{4})?$";
This will handle both 5-digit postal codes and extended 9-digit formats (ZIP+4).

  • Menu or App Changes:

Update the form or input pane in the app or menu to include the postalCode field.
When adding or editing a person, validate the postal code using the regex. If the postal code is invalid, show an error message like "Invalid postal code format."

  • Error Handling in the App:

If the postal code fails validation, prevent the user from saving or updating the record and display a message asking them to enter a valid postal code.

Expected sample

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions