Closed (won't fix)
Project:
Date
Version:
6.x-2.0
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
31 Mar 2009 at 13:37 UTC
Updated:
22 Dec 2011 at 14:05 UTC
I do not find an option to set a default value for the "Until" Date of the repeater. This would really be handy because it is tedious for the client to be forced to set all Fields on the dropdown list especially if Hour and Minute are also defined.
So I tried to do this using a form_alter.
But this does not seem to be so easy:
function form_alter_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'veranstaltung_node_form') {
$default_datum = format_date(time(), 'custom', DATE_FORMAT_DATETIME);
$form['field_datum_veranstaltung']['rrule']['#default_value'] = $default_datum;
}
}
If I dsm the form, the value shows for the Field ['rrule']['#default_value'], but it does not show on the form.
The funny thing is I can easily change the default value for the from Field:
if I use:
$form['field_datum_veranstaltung']['#default_value']['value'] = '2009-03-31 15:06:43';
this shows easily on the form.
So either I am still banging on the wrong field ( I tried them all :) ) or this Until Field is a little more tricky than I suspect.
Comments
Comment #1
phonecall commentedHi, I hope you have solved the problem; I had the same problem until yesterday night, I think I have solved (I'm not sure, the solution
needs some investigation, 'cause I'm not a drupal developer, and I'm not a developer at all)
I'm using Date 6.x-2.4
I altered all the until date in this way (for a event repeating weekly until 31 December 2012, 23:59)
$form['field_orario_lezione']['rrule']['INTERVAL']['#default_value']=1;
$form['field_orario_lezione']['rrule']['INTERVAL']['#value']=1;
$form['field_orario_lezione']['rrule']['FREQ']['#default_value']='WEEKLY';
$form['field_orario_lezione']['rrule']['FREQ']['#value']='WEEKLY';
$form['field_orario_lezione']['rrule']['UNTIL'] ['datetime']['day']['#default_value']='31';
$form['field_orario_lezione']['rrule']['UNTIL'] ['datetime']['day']['#value']='31';
$form['field_orario_lezione']['rrule']['UNTIL'] ['datetime']['month']['#default_value']='12';
$form['field_orario_lezione']['rrule']['UNTIL'] ['datetime']['month']['#value']='12';
$form['field_orario_lezione']['rrule']['UNTIL'] ['datetime']['year']['#default_value']='2012';
$form['field_orario_lezione']['rrule']['UNTIL'] ['datetime']['year']['#value']='2012';
$form['field_orario_lezione']['rrule']['UNTIL'] ['datetime']['hour']['#default_value']='23';
$form['field_orario_lezione']['rrule']['UNTIL'] ['datetime']['hour']['#value']='23';
$form['field_orario_lezione']['rrule']['UNTIL'] ['datetime']['minute']['#default_value']='59';
$form['field_orario_lezione']['rrule']['UNTIL'] ['datetime']['minute']['#value']='59';
Don't know why I have to set '#default_value' and '#value', but it works. I hope there's another better way to do that
Bye
Comment #2
arlinsandbulte commentedHi,
I am just indiscriminately closing all support requests with no activity for more than 1 year.
If you consider this to still be a valid issue / support request, feel free to re-open.
BUT,
if you are re-opening this issue, please provide specific details on how this issue can move forward.
Thanks.