WebVella/WebVella-ERP

relationship between tables and date validation

Closed this issue · 1 comments

"I would like to implement a date validation system to ensure that users must be at least 25 years old. For this, I need a method to validate the birthdate provided by the user and ensure it is more than 25 years ago.

Additionally, I have two tables: 'country' and 'address.' There is a one-to-many relationship between them, where a country can have multiple addresses. To enable users to add addresses from the country details page, I need to establish a reference in the UI. This involves creating a button or field that, when clicked, allows users to add an address associated with the specific country. The UI should capture the country's ID and store it in the address table when adding a new address."

How it can be done ?

The way I will do it is to create form, which the address related fields hidden in a collapsed section.
Country if needs to be matched should be either a select/dropdown or a typeahead.
On Form Post you validate and show relevant validation errors. In the post method you also make the matching of the posted country with the age requirement.