I have made two select fields with the form api d7
and i need to make it required and the first option is null to force the user select both
i tried with #REQUIRED #EMPTY_VALUE OPTION but gives error unsupported operands
i see the validation function may help but my case have an ajax request based on the first select to get the values of the second
so i need to make it required and the first is null
the code answer
$form['gov']=array('#title'=>'Gov','#name'=>'governorate'
,'#type'=>'select','#options'=>$options,'#ajax'=>array('callback'=>'ajax_callback',
'event'=>'change','wrapper'=>'replace'
,'method'=>'replace'));
$form['city']=array("#title"=>'City',
'#name'=>'city','#type'=>'select'
,'#prefix' => '<div id="replace">',
'#suffix' => '</div>','#options'=>$op);
also the ajax request only happens one time