diff options
author | Sashi20 | 2019-10-03 12:10:23 +0530 |
---|---|---|
committer | Sashi20 | 2019-10-03 12:10:23 +0530 |
commit | 7459cf9390414648d6b571863c49fc4ee5f68d73 (patch) | |
tree | d4b4f5e274f7ef24fb664efa5c9ddd20652b3e9c | |
parent | d58ba1e733acb11c89fb9f5379e48cf5e148a73e (diff) | |
download | DWSIM_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-x | code_approval.inc | 28 |
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) { |