Hi, I am trying to validate a CCK form submission. The validation needs to decimal field and if it is over a certain value, check that two other text fields were not left blank. Here is the flow I am trying to achieve: If the value is less 500, the form is valid. If over 500, then it is valid if field_a and field_b are both filled in. If either field is blank and the value is over 500, then the form is not valid.

Here is the code I am trying to use:

if ((int) $value < 500) {
return true;
} elseif (isset($form_state['values']['field_a']) and isset($form_state['values']['field_b'])) {
return true;
} else {
return false;
}

I would greatly appreciate some guidance. I have been able successfully test the $value only, but not for the blank text fields. I am concerned that the $form_state variables are being passed into the validator...