summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSashi202019-10-03 12:10:23 +0530
committerSashi202019-10-03 12:10:23 +0530
commit7459cf9390414648d6b571863c49fc4ee5f68d73 (patch)
treed4b4f5e274f7ef24fb664efa5c9ddd20652b3e9c
parentd58ba1e733acb11c89fb9f5379e48cf5e148a73e (diff)
downloadDWSIM_textbook_companion-7459cf9390414648d6b571863c49fc4ee5f68d73.tar.gz
DWSIM_textbook_companion-7459cf9390414648d6b571863c49fc4ee5f68d73.tar.bz2
DWSIM_textbook_companion-7459cf9390414648d6b571863c49fc4ee5f68d73.zip
Display exp no in the error message on empty reason for disapproval
-rwxr-xr-xcode_approval.inc28
1 files changed, 16 insertions, 12 deletions
diff --git a/code_approval.inc b/code_approval.inc
index 5f139e3..98098e4 100755
--- a/code_approval.inc
+++ b/code_approval.inc
@@ -155,20 +155,24 @@ function code_approval_form($form, &$form_state)
'#type' => 'hidden',
'#value' => $example_data->id
);
- } //$example_data = $example_q->fetchObject()
- $form['submit'] = array(
- '#type' => 'submit',
- '#value' => t('Submit')
- );
- return $form;
+ $form['example_details'][$example_data->id]['example_number_hidden'] = array(
+ '#type' => 'hidden',
+ '#value' => $example_data->number
+ );
+ }
+ $form['submit'] = array(
+ '#type' => 'submit',
+ '#value' => t('Submit')
+ );
+ return $form;
}
function code_approval_form_validate($form, &$form_state){
- foreach ($form_state['values']['example_details'] as $ex_id => $ex_data) {
- if ($ex_data['approved'] == "1"){
- if($ex_data['message'] == NULL || $ex_data['message'] == '')
- form_set_error('example_details', t('Enter reason for disapproval'));
- }
- }
+ foreach ($form_state['values']['example_details'] as $ex_id => $ex_data) {
+ if ($ex_data['approved'] == "1"){
+ if($ex_data['message'] == NULL || $ex_data['message'] == '')
+ form_set_error($ex_id . '][message', t('Enter reason for disapproval for experiment no: ' . $ex_data['example_number_hidden']));
+ }
+ }
}
function code_approval_form_submit($form, &$form_state)
{