in my form i have to show two radio button and one submit button, for example
candidate(radio)
organization(radio)
submit button.
my requirement is that
if user click/check on candidate and submit then candidate form should be open.
or
if user click/check on organization and submit then organization form should be open.
my code:
<?php
/**@file
*donation.module*/
/**
*Implements hook_menu()*/
function donation_menu(){
$items['donate'] = array(
'title' => 'Donate',
'page callback' => 'drupal_get_form',
'page arguments' => array('donation_donate_form'),
'access arguments' => array('access content'),
'access callback' => TRUE,
);
return $items;
}
/**
*Implements hook_form().
*/
function donation_donate_form($form, &$form_submit){
/*the options to display in our form radio buttons*/
$options = array
'candidate' => t('Candidate'),
'organization' => t('Organization'),
);
$form['officials'] = array(
'#title' => t('OFFICIALS'),
'#type' => 'radios',
'#options' => $options,
'#default_value' => $options['candidate'],
);
$form['name'] = array(
'#title' => t('NAME'),
'#type' => 'textfield',
);
$form['submit'] = array(
'#value' => t('PROCEED'),
'#type' => 'submit',
);
return $form;
}