From c3f0071e8267ea15768d61bce2753c8e443fd854 Mon Sep 17 00:00:00 2001 From: Sashi20 Date: Wed, 2 Jan 2019 10:40:21 +0530 Subject: Populating country field other than India in manage proposal --- manage_proposal.inc | 65 ++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/manage_proposal.inc b/manage_proposal.inc index d8aba72..0a421f2 100755 --- a/manage_proposal.inc +++ b/manage_proposal.inc @@ -718,6 +718,7 @@ function om_pssp_proposal_edit_form($form, &$form_state) '#required' => TRUE, '#default_value' => $proposal_data->university ); + if($proposal_data->country == 'India'){ $form['country'] = array( '#type' => 'select', '#title' => t('Country'), @@ -730,9 +731,38 @@ function om_pssp_proposal_edit_form($form, &$form_state) '#tree' => TRUE, '#validated' => TRUE ); + $form['all_state'] = array( + '#type' => 'select', + '#title' => t('State'), + '#options' => _df_list_of_states(), + '#default_value' => $proposal_data->state, + '#validated' => TRUE, + '#states' => array( + 'visible' => array( + ':input[name="country"]' => array( + 'value' => 'India' + ) + ) + ) + ); + $form['city'] = array( + '#type' => 'select', + '#title' => t('City'), + '#options' => _df_list_of_cities(), + '#default_value' => $proposal_data->city, + '#states' => array( + 'visible' => array( + ':input[name="country"]' => array( + 'value' => 'India' + ) + ) + ) + ); +} +else{ $form['other_country'] = array( '#type' => 'textfield', - '#title' => t('Other than India'), + '#title' => t('Country(Other than India)'), '#size' => 100, '#default_value' => $proposal_data->country, '#attributes' => array( @@ -748,7 +778,7 @@ function om_pssp_proposal_edit_form($form, &$form_state) ); $form['other_state'] = array( '#type' => 'textfield', - '#title' => t('State other than India'), + '#title' => t('State(Other than India)'), '#size' => 100, '#attributes' => array( 'placeholder' => t('Enter your state/region name') @@ -764,7 +794,7 @@ function om_pssp_proposal_edit_form($form, &$form_state) ); $form['other_city'] = array( '#type' => 'textfield', - '#title' => t('City other than India'), + '#title' => t('City(Other than India)'), '#size' => 100, '#attributes' => array( 'placeholder' => t('Enter your city name') @@ -778,33 +808,8 @@ function om_pssp_proposal_edit_form($form, &$form_state) ) ) ); - $form['all_state'] = array( - '#type' => 'select', - '#title' => t('State'), - '#options' => _df_list_of_states(), - '#default_value' => $proposal_data->state, - '#validated' => TRUE, - '#states' => array( - 'visible' => array( - ':input[name="country"]' => array( - 'value' => 'India' - ) - ) - ) - ); - $form['city'] = array( - '#type' => 'select', - '#title' => t('City'), - '#options' => _df_list_of_cities(), - '#default_value' => $proposal_data->city, - '#states' => array( - 'visible' => array( - ':input[name="country"]' => array( - 'value' => 'India' - ) - ) - ) - ); +} + $form['pincode'] = array( '#type' => 'textfield', '#title' => t('Pincode'), -- cgit