Welcome Guest, Not a member yet? Register   Sign In
Custom validation callback being ignored when corresponding input is empty
#1

[eluser]palaniappanc[/eluser]
I have a two custom callbacks in my application.

$rules['filenames']='callback_filenames_check'; //an array from multiple input fields
and
$rules['jbb']='callback_jbb_check'; //string from one input field

The first callback gets called pretty much as expected, but the second one only gets called if the corresponding input field is not empty. If it is empty, the callback is completely ignored.

What can I do to sort this out?

Thanks!
#2

[eluser]xwero[/eluser]
add required to the rule. It's standard behavior. If there is no input you can't check anything.
#3

[eluser]palaniappanc[/eluser]
xwero, check this out!

I initially tried required|callback_jbb_check before posting the question and it didn't work. callback_jbb_check|required works! Wow! Thanks.

I didn't think required will be required (ha), because I didn't use it for the first callback and it worked anyway...




Theme © iAndrew 2016 - Forum software by © MyBB