Hi Everyone,
I think this is a bug or if it's part of the framework but this is what is happening.
I created a module for the validation and this is the contents:
public static function check_sales_rep($x) {
$customer = $x[0];
$sales_rep = $x[1];
//print_r($x);
//return $customer ? ( $sales_rep != "" ) : true;
if($sales_rep != "")
{
return true;
}
}
public static function check_tax($x) {
$customer = $x[0];
$tax_group = $x[1];
if($tax_group == "BOB") //Test if it's BOB in the field
{
return true;
}
}
Public static function QFfield_Customer($form, $field, $label, $mode, $default, $desc, $rb_obj){
Utils_RecordBrowserCommon::QFfield_checkbox($form, $field, $label, $mode, $default, $desc, $rb_obj);
if ($mode == 'add' || $mode == 'edit') {
$form->registerRule('check_tax_code', 'callback', 'check_tax', 'Tst_BaseCommon');
$form->registerRule('check_sales_rep_rule', 'callback', 'check_sales_rep', 'Tst_BaseCommon');
$form->addRule(array('customer', 'tax_group'), __('Tax Required'), 'check_tax_code');
$form->addRule(array('customer', 'sales_rep'), __('Sales Rep Required'), 'check_sales_rep_rule');
var_dump($form);
}
}
As you can see in my screenshots, if the Tax group is above the page split's it tries to validate.
When I move it in the Customer Info Page split, it ignores the Tax group completely!
Is there something I miss in the code? is there a workaround?
Also if I move Sales Rep field in the page split, it too ingores the validation.
FYI, the Customer checkbox has the Tst_BaseCommon::QFfield_checkbox assigned to it.
thanks,
jjjj12212