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

(02-06-2016, 09:06 AM)skunkbad Wrote: But since the docs show that the callables feature is used in conjunction with "required", I am wondering if I am missing something? Ideally, if I leave out "required", and if there is no value to validate, the callable function would not run and cause validation to fail. That desired behavior is just the way form validation behaves when these callable functions are not used.

I guess I haven't tried it, and am too lazy to set up a test app, but if you don't use required, don't the other rules still run? For example, if you cascade required|in_list[A,B,C], validation will fail if the field isn't filled and also if it doesn't contain A, B, or C. But if you remove the required I'm thinking the validation would still fail the in_list rule.

Do you think better logic would be, if there's no required rule, then don't continue validating and just return true?
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
Reply


Messages In This Thread
RE: Form validation callables combined with "required" - by RobertSF - 02-08-2016, 05:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB