Answer the question
In order to leave comments, you need to log in
Approach or implementation for form validation?
There are several forms, it is necessary to validate the data for each form separately. There are several problems:
How the validation should look like:
an optional field, but if it is filled, then it must meet a certain condition,
several optional fields, but at least one of them must be filled,
several optional fields, but if one of them is filled , then the rest must be filled in as well?
How should the composition of the previous paragraphs look like?
Or should you not bother with such flexibility and write special checks for such cases?
Answer the question
In order to leave comments, you need to log in
Do you have any idea what kind of headache you want to deliver to the user with a similar form?
an optional field, but if it is filled, then it must meet a certain condition,
several optional fields, but at least one of them must be filled,
several optional fields, but if one of them is filled, then the rest must be filled in?
Take a look at the implementation of the validator in the Kohana 3 framework - I think it's a good example. You can implement a check if certain fields are filled in using callbacks, if I understand correctly what it is about.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question