From d62c7d56e20610f23ac6631fc2b0ae020b155e66 Mon Sep 17 00:00:00 2001 From: Sashi20 Date: Thu, 3 Oct 2019 12:09:10 +0530 Subject: Display exp no in the error message on empty reason for disapproval --- code_approval.inc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code_approval.inc b/code_approval.inc index 43ab0c4..1349344 100755 --- a/code_approval.inc +++ b/code_approval.inc @@ -128,7 +128,7 @@ function code_approval_form($form, &$form_state) $form['example_details'][$example_data->id]['example_number'] = array( '#type' => 'item', '#markup' => $example_data->number, - '#title' => t('Example Number') + '#title' => t('Example Number'), ); $form['example_details'][$example_data->id]['example_caption'] = array( '#type' => 'item', @@ -154,6 +154,10 @@ function code_approval_form($form, &$form_state) '#type' => 'hidden', '#value' => $example_data->id ); + $form['example_details'][$example_data->id]['example_number_hidden'] = array( + '#type' => 'hidden', + '#value' => $example_data->number + ); } $form['submit'] = array( '#type' => 'submit', @@ -165,7 +169,7 @@ 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')); + form_set_error($ex_id . '][message', t('Enter reason for disapproval for experiment no: ' . $ex_data['example_number_hidden'])); } } } -- cgit