So I have a conditional form field and need it to be required only if a specific checkbox is selected from a previous form field. Setting it to required with only the conditional "#states" option keeps it required even if the condition is to not display this field. So I thought perhaps I could add a condition to the value of "#required" but it doesn't appear to be working. Am I out of luck with this one?

Here's an example:

  $form['field2'] = array(
    '#type' => 'radios',
    '#title' => t('some question?'),
    '#options' => array(
      'yes' => t('Yes'),
      'no' => t('No')
    ),
    '#required' => ($form_state['values']['field1']['checkbox3'] == 0 ? FALSE : TRUE),    //###<--- this is what I'm trying to figure out ###
    '#states' => array(
      'visible' => FALSE,
      'visible' => array(
        ':input[name="field1[checkbox3]"]' => array(
          'checked' => TRUE
        ),
      )
    )
  );

Note that field1 will contain multiple checkboxes.