Welcome Guest, Not a member yet? Register   Sign In
Possible form validation bug?
#9

[eluser]slowgary[/eluser]
It sounds like a bug to me, but what do I know. The user guide says:
Quote:You can also process the form data that is passed to your callback and return it.
If your callback returns anything other than a boolean TRUE/FALSE it is assumed
that the data is your newly processed form data.
I take that to say that if your callback returns a non-boolean then it ignores the other validation rules as it assumes you've already processed the data. That means the opposite should be true - a boolean return should continue the validation UNLESS it returns FALSE in which case it would have failed that 'validation rule' and would bark an error. In your case you are returning TRUE, which means that the data has passed your custom validation and should be tested against the others sequentially.

The only part that's a bit questionable is that in the examples they do not combine native validation rules with callbacks. Also, they don't call them "Custom Validation Functions". The very name "callback" makes me suspect that they don't treat it as a normal validation rule. The user guide says form validation accepts any native PHP function that takes 1 parameter. Will it also accept custom functions with 1 parameter? Maybe the "callback_" prefix is only necessary in the event that your function may return prepared data instead of TRUE of FALSE. Have you tried removing the "callback_" prefix from your example code?


Messages In This Thread
Possible form validation bug? - by El Forum - 06-29-2009, 01:15 PM
Possible form validation bug? - by El Forum - 06-29-2009, 03:15 PM
Possible form validation bug? - by El Forum - 06-29-2009, 03:23 PM
Possible form validation bug? - by El Forum - 06-29-2009, 03:59 PM
Possible form validation bug? - by El Forum - 06-29-2009, 04:26 PM
Possible form validation bug? - by El Forum - 06-29-2009, 04:28 PM
Possible form validation bug? - by El Forum - 06-29-2009, 04:45 PM
Possible form validation bug? - by El Forum - 06-29-2009, 05:46 PM
Possible form validation bug? - by El Forum - 06-29-2009, 06:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB