Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
By nags338228 on
hi....
I am using date module. I got a requirement that the user should not enter the previous dates. I mean the date popup should show only present and future dates only. The granularity should be month. Here the widget type is "Date popup Calender"
can any body suggest how to do this......
Thanks in Advance.......
Comments
can any body please
can any body please suggest????
i googled but i didnt get.. pls help me..
hurray I got the
hurray I got the script.................
I think this snippet may help some body
place this code in head
where to place this
where to place this particular code
not clear about the head you specified
please do let know thanks in advance
put that code in theme tag
put that code in theme tag in page.tpl file, or if u r having any particular .tpl file., place.it.
code to restrict date
did not work for me
I used as
drupal_add_js("
(function ($) {
$(document).ready(function() {
$('#edit-attendance-date-datepicker-popup-0' ).datepicker({ minDate: -10, maxDate: '+1M +10D' });
});
})(jQuery);
", 'inline');
$form['attendance_date'] = array(
'#type' => 'date_popup',
'#title' => t('Attendance date'),
'#description' => t('Please select the date of attendance'),
'#required' => TRUE,
'#date_format' => 'Y-m-d',
'#attributes' => array('autocomplete' =>'off','readonly' => 'readonly'),
'#default_value' => date('Y-m-d'),
);
Changes
drupal_add_js("
(function ($) {
$(document).ready(function() {
$('#edit-attendance-date-datepicker-popup-0' ).datepicker({ minDate: -10, maxDate: '+10M +10D' });
});
})(jQuery);
", 'inline');
$form['attendance_date'] = array(
'#type' => 'date_popup',
'#title' => t('Attendance date'),
'#description' => t('Please select the date of attendance'),
'#required' => TRUE,
'#date_format' => 'Y-m-d',
'#attributes' => array('autocomplete' =>'off','readonly' => 'readonly'),
'#default_value' => date('Y-m-d'),
);
Where to put
@umar.adil
Where did you put this code?
I cannot seem to get this to work...
Hope you can assist me on this.
I'm using a date picker in combination with 'uc_visit_time' on a order confirmation page.
Basic theme I use is 'Zeropoint'.
Thanks in advance
not work for me
hello Sir i use the same code and place it into head portion using .info file and i am using the full calendar module .. i want that if some one select a date from popup_date its only select the present and furture dates please can you help me out
Maybe this will help with setting a future date
I read this post before. Maybe it'll help with setting only future dates? http://www.econcepts.co.uk/snippets/adding-date-validation-only-future-d...
This is now supported in Date 7.x-2.6 (for Drupal 7)
There's a patch to get it backported for Drupal 6 as well, check the issue.
Simply put date_popup fields now accept custom options that are supported by jQuery UI datepicker. Example:
If you need to alter an existing form use hook_form_alter() and make sure you just add/change the necessary bits without overwriting everything:
Where to find an structure '#type' => 'date_popup',?
I am creating a website where users should manage with dates. It,s a website about tourism services, so, generally all picked dates have to belong to the future.
The thing is: I am not able to find where to apply what Madis is describing here. I have created a content type with a field of "Date" type, but I do not find any structure in my form that match '#type' => 'date_popup'. I find always the date_combo structure, but as I said no date_popup at all.
I am using latest Drupal version (7.23) and Date module version (7.x-2.8).
If I create the Date field myself through the API it works, but I am not able to modify the form that Drupal is generating.
Any help would be appreciated. Thanks in advance.
Diego
Solved!
I answer myself. Obviously I was looking in the wrong place!
Instead of using a date_popup module hook, I was looking in the form through "hook_form_alter".
Finally I managed to modify the date_popup structure through hook_date_popup_process_alter (http://drupalcontrib.org/api/drupal/contributions!date!date.api.php/func...)
For example:
Best, Diego
Thank you for the solution.
I have implemented the hook mentioned above with 'minDate' => "+1D" for showing only present and future dates.
Thank you!
Great..!!Thanks its worked for me.
Disable future dates newer than today in date module
How to disable dates, if it is greater than current date in date module?
I've done myself as below:
http://www.phponwebsites.com/
Very good solution. It worked
Very good solution. It worked for me.
Thanks its working.
Thanks its working.
Thank you
Works Great..!!
need solution code
i need the solution code if any one have the solution please help me out .... i have the same problem and test all the solutions from this page but fail not working for me
Hello,
Hello,
Which version of drupal ?