Welcome Guest, Not a member yet? Register   Sign In
Form validation callables combined with "required"
#8

If the required rule is not used, your callbacks should assume that an empty value is valid. Otherwise, you would use the required rule, right?

On the other hand, I might have a callback which acts as a conditional required rule. I might check other values, either in the $_POST or the database, then determine that a field is required in this situation, and that the empty field is either required or not required. If the callbacks aren't run unless the required rule is in place, then I can't really do conditionally-required fields based on the other values submitted in a form.

One of my most common uses for this type of validation is when someone selects "Other" in a list of radio buttons or checkboxes, at which point the text input for "Other" becomes a required field.
Reply


Messages In This Thread
RE: Form validation callables combined with "required" - by mwhitney - 02-09-2016, 07:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB