From 9ecc8ddfcbf1cc2ad9d65f35a6018e1607f3f395 Mon Sep 17 00:00:00 2001 From: Sashi20 Date: Wed, 6 Mar 2019 12:23:44 +0530 Subject: Mandated the pincode field, added description to other reason field in proposal form --- textbook_companion.module | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/textbook_companion.module b/textbook_companion.module index ed33638..aa5fbb5 100755 --- a/textbook_companion.module +++ b/textbook_companion.module @@ -1911,7 +1911,7 @@ function book_proposal_form($form, &$form_state) '#title' => t('Pincode'), '#size' => 30, '#maxlength' => 6, - '#required' => False, + '#required' => TRUE, '#attributes' => array( 'placeholder' => 'Enter pincode....' ) @@ -1994,6 +1994,7 @@ function book_proposal_form($form, &$form_state) '#type' => 'textarea', '#size' => 300, '#maxlength' => 300, + '#description'=>t('Maximum character limit is 255 characters'), '#states' => array( 'visible' => array( ':input[name="reason[Other reason]"]' => array( @@ -2306,6 +2307,14 @@ function book_proposal_form_validate($form, &$form_state) /***************************************************************************** }*/ + if (isset($form_state['values']['reason'])) + { + $my_reason = $form_state['values']['other_reason']; + if($my_reason>255) + { + form_set_error('other_reason', t('Maximum limit is 255 characters')); + } + } if ($form_state['values']['version'] == 'Other version') { if ($form_state['values']['other_version'] == '') -- cgit