validation of text box and checkbox I am trying to validate the form. I have one hidden textbox and one check box group.


field_institute_event - represents checkbox group.
posted_student_list - represents hidden text box.


If both are empty then I want to display error message. How to do that??

I am trying following code:

if((empty($form_state['values']['field_institute_event']['und'][0]['entity']-&gt;field_institute_event_group[LANGUAGE_NONE]))
        &amp;&amp;
        (empty($form_state['values']['posted_student_list']['und'][0]['entity']-&gt;field_institute_event_group[LANGUAGE_NONE])) ) {
  form_set_error('field_institute_event_group',t('Please Post to atleast one group'));
}
if((empty($form_state['values']['field_institute_event']){
form_set_error('field_institute_event', t('YOURMESSAGE'));
}


That should do it. If you  want to validate on empty value on a required element.
You could also add the '#required' => true on your form element.