How to make the submit button not appear on form unless an option is selected from radios? I have a form with three form elements:


'#type' =&gt; 'radios' element having two options (Yes or No),
'#type' =&gt; 'submit' &amp;
'#type' =&gt; 'checkbox'


When the user lands on the form page, he should only see the radios element first and can see the checkbox &amp; submit elements only if he selects an option from radios element.

Is there a Drupal way to do this using the Form API?
You can use #states attribute in form api to hide submit button and check box

For Example

$form['email_canceled']['settings'] = array(
    '#type' =&gt; 'container',
    '#states' =&gt; array(

      // Hide the settings when the cancel notify checkbox is disabled.

      'invisible' =&gt; array(

       ':input[name="email_canceled_toggle"]' =&gt; array('checked' =&gt; FALSE),
      ),
    ),
  );