summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSashi202019-01-02 11:35:49 +0530
committerGitHub2019-01-02 11:35:49 +0530
commit87245eabf40f9ab78597e154415a1183eabdc84a (patch)
tree4a0cf136307d7fdbe4e46b0a8c16ef61990032e0
parent12a6ef432d7d1d30ae8e129fd39902287e77ad68 (diff)
parentc3f0071e8267ea15768d61bce2753c8e443fd854 (diff)
downloadom_pssp-87245eabf40f9ab78597e154415a1183eabdc84a.tar.gz
om_pssp-87245eabf40f9ab78597e154415a1183eabdc84a.tar.bz2
om_pssp-87245eabf40f9ab78597e154415a1183eabdc84a.zip
Merge pull request #4 from Sashi20/master
Minor changes to proposal form and manage proposal
-rwxr-xr-xmanage_proposal.inc67
-rwxr-xr-xproposal.inc44
2 files changed, 62 insertions, 49 deletions
diff --git a/manage_proposal.inc b/manage_proposal.inc
index 3f7e3fd..0a421f2 100755
--- a/manage_proposal.inc
+++ b/manage_proposal.inc
@@ -708,7 +708,7 @@ function om_pssp_proposal_edit_form($form, &$form_state)
'#datepicker_options' => array(
'maxDate' => 0
),
- '#required' => TRUE
+ '#required' => FALSE
);
$form['university'] = array(
'#type' => 'textfield',
@@ -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'),
diff --git a/proposal.inc b/proposal.inc
index e4ea2b2..97fa93b 100755
--- a/proposal.inc
+++ b/proposal.inc
@@ -51,6 +51,7 @@ function om_pssp_proposal_form($form, &$form_state, $no_js_use = FALSE)
return;
} //$proposal_data->approval_status == 0 || $proposal_data->approval_status == 1
} //$proposal_data
+ $imp = t('<span style="color: red;">*This is a mandatory field</span>');
$form['#attributes'] = array(
'enctype' => "multipart/form-data"
);
@@ -148,7 +149,8 @@ function om_pssp_proposal_form($form, &$form_state, $no_js_use = FALSE)
'value' => 'Others'
)
)
- )
+ ),
+ '#description' => $imp,
);
$form['other_state'] = array(
'#type' => 'textfield',
@@ -163,7 +165,8 @@ function om_pssp_proposal_form($form, &$form_state, $no_js_use = FALSE)
'value' => 'Others'
)
)
- )
+ ),
+ '#description' => $imp,
);
$form['other_city'] = array(
'#type' => 'textfield',
@@ -178,7 +181,8 @@ function om_pssp_proposal_form($form, &$form_state, $no_js_use = FALSE)
'value' => 'Others'
)
)
- )
+ ),
+ '#description' => $imp,
);
$form['all_state'] = array(
'#type' => 'select',
@@ -191,19 +195,22 @@ function om_pssp_proposal_form($form, &$form_state, $no_js_use = FALSE)
'value' => 'India'
)
)
- )
+ ),
+ '#description' => $imp
);
$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'
+ )
+ )
+ ),
+ '#description' => $imp,
);
$form['pincode'] = array(
'#type' => 'textfield',
@@ -286,7 +293,7 @@ function om_pssp_proposal_form($form, &$form_state, $no_js_use = FALSE)
);*/
$form['samplefile'] = array(
'#type' => 'fieldset',
- '#title' => t('Upload Abstract<span style="color:red;">*</span>'),
+ '#title' => t('Upload Abstract<span style="color:red;">&nbsp;*</span>'),
'#collapsible' => FALSE,
'#collapsed' => FALSE
);
@@ -350,17 +357,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 +608,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');
}
+