Welcome Guest, Not a member yet? Register   Sign In
Cascading Validation callbacks not all being called
#1

[eluser]Kepi[/eluser]
I have a custom Validation callback that is a variation on the built-in 'required' rule. Specifically, if the form field the callback is being called on has a value, then the form field specified as the parameter to the callback must also have a value. It all works great, but I'm having an issue where the cascading nature of the rules doesn't seem to hold up.

Part of the form has what could be considered line items with three fields each. I use the callback to ensure that if one of those three fields of a given line item has a value, the other two do as well. The rules are set up as follows (code simplified for readability):
Code:
$rules["fieldOne"] = "callback_blah[fieldTwo]|callback_blah[fieldThree]";
$rules["fieldTwo"] = "callback_blah[fieldOne]|callback_blah[fieldThree]";
$rules["fieldThree"] = "callback_blah[fieldOne]|callback_blah[fieldTwo]";
If I put a value in any one field and nothing in the other two, I get the correct error message (but only from the first callback listed in that field's rules). If I put a value in fieldOne and fieldTwo, no error is returned (i.e. the callback isn't called for fieldThree).

It seems the callbacks don't cascade beyond a 'true' result. Am I setting something up incorrectly, or does the cascading rule functionality not support what I'm attempting to do?
#2

[eluser]saiprasad.ch[/eluser]
Yes ! the callbacks don’t cascade beyond a ‘true’ result. Thats really a weird thing in the validations....




Theme © iAndrew 2016 - Forum software by © MyBB