summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmanage_proposal.inc64
-rwxr-xr-xproposal.inc47
2 files changed, 66 insertions, 45 deletions
diff --git a/manage_proposal.inc b/manage_proposal.inc
index 0733812..17aefe5 100755
--- a/manage_proposal.inc
+++ b/manage_proposal.inc
@@ -847,6 +847,7 @@ function dwsim_flowsheet_proposal_edit_form($form, &$form_state)
'#maxlength' => 200,
'#default_value' => $proposal_data->project_guide_university
);
+ if($proposal_data->country == 'India'){
$form['country'] = array(
'#type' => 'select',
'#title' => t('Country'),
@@ -859,9 +860,38 @@ function dwsim_flowsheet_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(
@@ -877,7 +907,7 @@ function dwsim_flowsheet_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')
@@ -893,7 +923,7 @@ function dwsim_flowsheet_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')
@@ -907,33 +937,7 @@ function dwsim_flowsheet_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 30836b5..67d60b9 100755
--- a/proposal.inc
+++ b/proposal.inc
@@ -51,6 +51,7 @@ function dwsim_flowsheet_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"
);
@@ -171,7 +172,8 @@ function dwsim_flowsheet_proposal_form($form, &$form_state, $no_js_use = FALSE)
'value' => 'Others'
)
)
- )
+ ),
+ '#description' => $imp,
);
$form['other_state'] = array(
'#type' => 'textfield',
@@ -186,7 +188,8 @@ function dwsim_flowsheet_proposal_form($form, &$form_state, $no_js_use = FALSE)
'value' => 'Others'
)
)
- )
+ ),
+ '#description' => $imp,
);
$form['other_city'] = array(
'#type' => 'textfield',
@@ -201,7 +204,8 @@ function dwsim_flowsheet_proposal_form($form, &$form_state, $no_js_use = FALSE)
'value' => 'Others'
)
)
- )
+ ),
+ '#description' => $imp,
);
$form['all_state'] = array(
'#type' => 'select',
@@ -214,19 +218,22 @@ function dwsim_flowsheet_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',
@@ -457,6 +464,16 @@ function udc_compound_add_more_callback($form, &$form_state)
/***************************************/
function dwsim_flowsheet_proposal_form_validate($form, &$form_state)
{
+ $project_title = $form_state['values']['project_title'];
+ $query = db_select('om_pssp_proposal');
+ $query->fields('om_pssp_proposal');
+ $query->condition('project_title', $project_title);
+ $result = $query->execute()->rowCount();
+ if ($result >= 1)
+ {
+ form_set_error('project_title', t('Project title name already exists'));
+ return;
+ }
if ($form_state['values']['term_condition'] == '1')
{
form_set_error('term_condition', t('Please check the terms and conditions'));
@@ -709,7 +726,7 @@ function dwsim_flowsheet_proposal_form_submit($form, &$form_state)
":project_guide_name" => _df_sentence_case($v['project_guide_name']),
":project_guide_email_id" => trim($v['project_guide_email_id']),
":project_guide_university" => trim($v['project_guide_university']),
- ":project_title" => _df_sentence_case($v['project_title']),
+ ":project_title" => $v['project_title'],
":process_development_compound_name" => _df_sentence_case($v['process_development_compound_name']),
":process_development_compound_cas_number" => $v['process_development_compound_cas_no'],
":dwsim_database_compound_name" => trim($v['dwsim_database_compound_name']),