diff options
author | Sashi20 | 2018-06-14 16:13:02 +0530 |
---|---|---|
committer | Sashi20 | 2018-06-14 16:13:02 +0530 |
commit | 5838d1eaed327f1de5ded94d6aa20526dbb526dd (patch) | |
tree | f1e8db8ca9d3e6024b9ef6edac864406f45e7ace /textbook_companion.module | |
parent | a88a6588880cc7bc2676962f579268bc6ef13b7a (diff) | |
download | r_textbook_companion-5838d1eaed327f1de5ded94d6aa20526dbb526dd.tar.gz r_textbook_companion-5838d1eaed327f1de5ded94d6aa20526dbb526dd.tar.bz2 r_textbook_companion-5838d1eaed327f1de5ded94d6aa20526dbb526dd.zip |
Added Information Technology in list of departments and textfield when Others is selected in Department
Diffstat (limited to 'textbook_companion.module')
-rwxr-xr-x | textbook_companion.module | 52 |
1 files changed, 45 insertions, 7 deletions
diff --git a/textbook_companion.module b/textbook_companion.module index 2b8fa24..b05a69d 100755 --- a/textbook_companion.module +++ b/textbook_companion.module @@ -1797,7 +1797,23 @@ function book_proposal_form($form, &$form_state) '#type' => 'select', '#title' => t('Department/Branch'), '#options' => _list_of_departments(), - '#required' => TRUE + '#required' => TRUE, + '#tree' => TRUE, + ); + $form['other_branch'] = array( + '#type' => 'textfield', + '#title' => t('Enter your Department/Branch name'), + '#size' => 50, + '#attributes' => array( + 'placeholder' => t('Enter your Department/Branch name') + ), + '#states' => array( + 'visible' => array( + ':input[name="branch"]' => array( + 'value' => 'Others' + ) + ) + ) ); $form['university'] = array( '#type' => 'textfield', @@ -2362,10 +2378,15 @@ function book_proposal_form_submit($form, &$form_state, $directory_name = NULL) { $form_state['values']['version'] = $form_state['values']['other_version']; } //$form_state['values']['version'] == 'Other version' - if ($form_state['values']['country'] == 'other') + if($form_state['values']['branch'] == 'Others') { + $form_state['values']['branch'] =$form_state['values']['other_branch']; + } + if ($form_state['values']['country'] == 'Others') { - $form_state['values']['country'] = trim($form_state['values']['other_country']); - $form_state['values']['all_state'] = trim($form_state['values']['other_state']); + $form_state['values']['country'] = $form_state['values']['other_country']; + $form_state['values']['all_state'] = $form_state['values']['other_state']; + $form_state['values']['city'] = $form_state['values']['other_city']; + //$form_state['values']['pincode'] = $form_state['values']['other_pincode']; } //$form_state['values']['country'] == 'other' if (isset($_POST['reason'])) { @@ -2392,7 +2413,7 @@ function book_proposal_form_submit($form, &$form_state, $directory_name = NULL) ":gender" => $form_state['values']['gender'], ":how_project" => $form_state['values']['how_project'], ":course" => trim($form_state['values']['course']), - ":branch" => $form_state['values']['branch'], + ":branch" => trim($form_state['values']['branch']), ":university" => trim($form_state['values']['university']), ":city" => trim($form_state['values']['city']), ":pincode" => $form_state['values']['pincode'], @@ -3933,12 +3954,29 @@ function book_proposal_nonaicte_form($form, &$form_state) '#maxlength' => 50, '#required' => TRUE ); - $form['department'] = array( + $form['branch'] = array( '#type' => 'select', '#title' => t('Department/Branch'), '#options' => _list_of_departments(), - '#required' => TRUE + '#required' => TRUE, + '#tree' => TRUE, + ); + $form['other_branch'] = array( + '#type' => 'textfield', + '#title' => t('Enter your Department/Branch name'), + '#size' => 50, + '#attributes' => array( + 'placeholder' => t('Enter your Department/Branch name') + ), + '#states' => array( + 'visible' => array( + ':input[name="branch"]' => array( + 'value' => 'Others' + ) + ) + ) ); + $form['university'] = array( '#type' => 'textfield', '#title' => t('University/ Institute'), |