Answered by:
hide date in date time field CRM 4.0

Question
-
Hi,
I would like only the time to be displayed of the date time field. I have used the code below which works. However the only issue with this is that eveytime i change the fields and save the form when i go back into it ignores the value i had entered and puts in the current time into the field.
I have put the code below on the form onload comand. Is there anything i could do in order to keep the value i have changed in the form once i have saved it.
crmForm.all.kf_timealertalarmraisedtoeldercare.DataValue = new Date(); document.getElementById("kf_timealertalarmraisedtoeldercare").childNodes[0].childNodes[0].style.display = "none"; document.getElementById("kf_timealertalarmraisedtoeldercare").childNodes[0].childNodes[1].style.display = "none";
Any help with this will realy be helpful.
Thank you
- Edited by Kully88 Friday, October 11, 2013 8:22 AM
Friday, October 11, 2013 8:12 AM
Answers
-
Hi,
you need to add a condition to set the date when the field is empty, try withif (crmForm.all.kf_timealertalarmraisedtoeldercare.DataValue == null) { crmForm.all.kf_timealertalarmraisedtoeldercare.DataValue = new Date(); } document.getElementById("kf_timealertalarmraisedtoeldercare").childNodes[0].childNodes[0].style.display = "none"; document.getElementById("kf_timealertalarmraisedtoeldercare").childNodes[0].childNodes[1].style.display = "none";
My blog: www.crmanswers.net
Friday, October 11, 2013 8:22 AM
All replies
-
Hi,
you need to add a condition to set the date when the field is empty, try withif (crmForm.all.kf_timealertalarmraisedtoeldercare.DataValue == null) { crmForm.all.kf_timealertalarmraisedtoeldercare.DataValue = new Date(); } document.getElementById("kf_timealertalarmraisedtoeldercare").childNodes[0].childNodes[0].style.display = "none"; document.getElementById("kf_timealertalarmraisedtoeldercare").childNodes[0].childNodes[1].style.display = "none";
My blog: www.crmanswers.net
Friday, October 11, 2013 8:22 AM -
Hi Guido Preite
Thank you so much for your quick response.
That has worked perfectly.
Thanks again :)
Friday, October 11, 2013 8:30 AM