Time gets saved as 00:00:00 in date/time field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2016 06:39 AM
Hello guys,
Can anyone please help??!!
We have this field on our instance "contact_date" which is date/time field which captures the current date and time (client scripts are designed for the same)once the choice is selected from the drop down field (u_contact_sucessfull).
Now the issue is:
1. I select the option from the drop down (e.g. Phone)
2. Contact date gets populated (form is not yet saved)
3. save the form.
4. check the field if the date and time is properly captured, but Date stays and times turns 00:00:00.
Script to populate the time and date is as:
**** onChange Client script ****
if (g_form.getValue('u_contact_date') == '') {
var d =new Date();
var navigator=window.navigator.appName;
if (navigator == 'Microsoft Internet Explorer') {
// var d =new Date();
var now = gr.nowDateTime();
var day = d.getDate();
var month = d.getMonth() + 1;
var year = d.getFullYear();
//g_form.setValue('u_contact_date', day+"-"+month+"-"+year +" "+d.toLocaleTimeString());
g_form.setValue('u_contact_date', now);
} else {
var strDate = replaceAll(d.toLocaleString(),'/', '-');
g_form.setValue('u_contact_date', strDate);
}
}
function replaceAll(txt, replace, with_this) {
return txt.replace(new RegExp(replace, 'g'),with_this);
}
Can anyone please suggest what's going wrong.? Help is much appreciated.!!
Ankita.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2016 05:26 AM
That's odd. It worked great for me.
Perhaps a few debug statements in the client script and script include can help tell us where things are going (and not going.) Do you feel confident debugging with gs.debug/info/warn/error statements? (If it's a global app then gs.log still works.)