Sorry i dont quite understand your answer, i was thinking that if it can be done in the rules function of the model somehow it would be easier
public function rules()
{
return array(
array('customer_ID, allCustomers', 'justone'),
array('daterange, report_ID, customer_ID, jobnumber, daterangestd, dateFrom, dateTo, allCustomers ', 'safe'),
);
}
//validation function
public function justone (){
//something like if both have something in return error message stating this
}
public function onlyOneValidator($attribute,$params){
if(!$this->isEmpty($this->dropdown) && !$this->isEmpty($this->checkbox))
$this->addErrors(array('only one must be selected'));
}
protected function isEmpty($value,$trim=false)
{
return $value===null || $value===array() || $value==='' || $trim && is_scalar($value) && trim($value)==='';
}
Thanks all for the help its working fine , one more question however , is there any reason this wouldn’t work with ajax ? all fields show green as I am stepping through the form , its only on submit I get the correct error