Date Time Picker customization

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2012 07:35 AM
From a request we had by the process owners of change, we developed a onLoad client script to set the DateTime picker to default to zeros on the time entry so when the icon is clicked, the time is defaulted to 00:00:00 in the popup.
Here is our current code
function onLoad() { setDatePickerTime('start_date'); setDatePickerTime('end_date'); setDatePickerTime('requested_by_date'); setDatePickerTime('work_start'); setDatePickerTime('work_end'); function setDatePickerTime(field){ //Attach an event listener to set default time value for date picker Event.observe(g_form.getControl(field).next('a'), 'click', function() { $('GwtDateTimePicker_hh').value = '00'; $('GwtDateTimePicker_mm').value = '00'; $('GwtDateTimePicker_ss').value = '00'; }); } }
Works fine in Aspen, but not in Berlin. We are getting java errors in IE and although we do not get errors in Chrome/Firefox, it does not change the time entries to zeros.
Does anyone have any ideas what changes I might make to allow this to work again in Berlin?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2015 12:55 PM
yes, will you paste your code so I can look it over?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2015 03:58 AM
hi,
trying as below
function setDatePickerTime(field){
//Attach an event listener to set default time value for date picker
var linkElement = $(g_form.getControl(field).id).next();
if (linkElement !== undefined) {
alert(linkElement);
Event.observe($(g_form.getControl(field).id).next(), 'click', function() { setTimeout("$('GwtDateTimePicker_hh').value = '00';$('GwtDateTimePicker_mm').value = '00';$('GwtDateTimePicker_ss').value = '00';",300); });
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2015 02:52 PM
Here is what I'm using.
This is an onload client script.
function setDatePickerTime(field, hour){
if(g_form.getValue(field)!=''){
return;
}
//Attach an event listener to set default time value for date picker
Event.observe($(g_form.getControl(field).id).next(), 'click', function() {
setTimeout("$('GwtDateTimePicker_hh').value = " + hour +";$('GwtDateTimePicker_mm').value = '00';$('GwtDateTimePicker_ss').value = '00';",300);
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2015 01:06 AM
Hi Shannon,
I tried this as well but it is still not working, I forgot to mention that i am trying this in scoped application.
Please let me know if you can help me on this.
Regards,
Girish Deshpande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2015 07:30 AM
Hi Girish,
I saw a post on a website a few weeks ago about scoped apps not having access to the DOM. I can't seem to find that post anymore, otherwise I would refer you to it. I'm pretty sure that is the problem you are running into. When I get some time, I will test it out in a scoped app and see if I can make it work.
Shannon