From 43912eabb331bed862039a4e6d106f062df9bb99 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Tue, 23 Oct 2018 15:45:23 +0530 Subject: added javascript for date validation --- workshop_registration.inc | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) (limited to 'workshop_registration.inc') diff --git a/workshop_registration.inc b/workshop_registration.inc index 3de34ed..7b6d6fd 100644 --- a/workshop_registration.inc +++ b/workshop_registration.inc @@ -1,5 +1,40 @@ 31 ){ + alert('Enter correct To date'); + $('input#edit-workshop-info-checklist-group-suggested-date-end-date-datepicker-popup-0').val(''); + }else{ + alert('Check the To date'); + $('input#edit-workshop-info-checklist-group-suggested-date-end-date-datepicker-popup-0').val(field_date1_next); + } + }else{ + $('input#edit-workshop-info-checklist-group-suggested-date-end-date-datepicker-popup-0').val(field_date1); + } + }); + } +}; +})(jQuery); +"; +drupal_add_js($date_picker_js,array( + 'type' => 'inline', + 'scope' => 'footer', + 'weight' => 5, +)); + function osdag_workshop_booking_form($form, &$form_state) { global $user; @@ -302,8 +337,7 @@ function osdag_workshop_booking_form($form, &$form_state) '#date_increment' => 0, '#date_year_range' => $cur_year.':+0', '#datepicker_options' => array( - 'minDate' => date("d-m-y"), - 'maxDate' => 0, + 'minDate' => 10, 'dateFormat' => date_popup_format_to_popup('d-m-Y'), ), ); @@ -318,7 +352,6 @@ function osdag_workshop_booking_form($form, &$form_state) '#date_increment' => 1, '#date_year_range' => $cur_year.':+0', '#datepicker_options' => array( - 'maxDate' => 0, 'dateFormat' => date_popup_format_to_popup('d-m-Y'), ), ); @@ -409,10 +442,6 @@ function osdag_workshop_booking_form_validate($form, &$form_state) if (!preg_match('/^[0-9]{0,2}$/', $form_state['values']['workshop_info']['volunteers'])) form_set_error('volunteers', t('Invalid number of volunteer')); - if($v['workshop_info']['workshop_type'] == '1-day training workshop'){ - $v['workshop_info']['checklist_group']['suggested_date']['end_date'] = - $v['workshop_info']['checklist_group']['suggested_date']['start_date']; - } } function osdag_workshop_booking_form_submit($form, &$form_state) -- cgit