diff options
author | Sashi20 | 2018-12-31 11:49:02 +0530 |
---|---|---|
committer | Sashi20 | 2018-12-31 11:49:02 +0530 |
commit | f1fdc0e3b45f6277b42e85161db701b1cb7a2aa4 (patch) | |
tree | 65e73f1fde48a124a0af859a028af08c911d6dca | |
parent | 2404f69afcca5e95b8270a6e865159f3cf1e9c03 (diff) | |
download | om_pssp-f1fdc0e3b45f6277b42e85161db701b1cb7a2aa4.tar.gz om_pssp-f1fdc0e3b45f6277b42e85161db701b1cb7a2aa4.tar.bz2 om_pssp-f1fdc0e3b45f6277b42e85161db701b1cb7a2aa4.zip |
Fixed form validation for state and city fields in proposal form
-rwxr-xr-x | proposal.inc | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/proposal.inc b/proposal.inc index e4ea2b2..7e8eb8d 100755 --- a/proposal.inc +++ b/proposal.inc @@ -191,19 +191,20 @@ function om_pssp_proposal_form($form, &$form_state, $no_js_use = FALSE) 'value' => 'India' ) ) - ) + ), ); $form['city'] = array( - '#type' => 'select', - '#title' => t('City'), - '#options' => _df_list_of_cities(), - '#states' => array( - 'visible' => array( - ':input[name="country"]' => array( - 'value' => 'India' - ) - ) - ) + '#type' => 'select', + '#title' => t('City'), + '#options' => _df_list_of_cities(), + '#validated' => TRUE, + '#states' => array( + 'visible' => array( + ':input[name="country"]' => array( + 'value' => 'India' + ) + ) + ), ); $form['pincode'] = array( '#type' => 'textfield', @@ -350,17 +351,17 @@ function om_pssp_proposal_form_validate($form, &$form_state) } //$form_state['values']['country'] == 'Others' else { - if ($form_state['values']['country'] == '') + if ($form_state['values']['country'] == '0') { form_set_error('country', t('Select country name')); // $form_state['values']['country'] = $form_state['values']['other_country']; } //$form_state['values']['country'] == '' - if ($form_state['values']['all_state'] == '') + if ($form_state['values']['all_state'] == '0') { form_set_error('all_state', t('Select state name')); // $form_state['values']['country'] = $form_state['values']['other_country']; } //$form_state['values']['all_state'] == '' - if ($form_state['values']['city'] == '') + if ($form_state['values']['city'] == '0') { form_set_error('city', t('Select city name')); // $form_state['values']['country'] = $form_state['values']['other_country']; @@ -601,3 +602,4 @@ function om_pssp_proposal_form_submit($form, &$form_state) drupal_set_message(t('We have received your power systems simulation proposal. We will get back to you soon.'), 'status'); drupal_goto('powersystems'); } + |