Hi Communties
I build a zovertime_start_time and zovertime_end_time. We use the default field Called Return_of_service(Display name zovertime) when (Yes) show the two date fields and no don't. The Yes portion works and think. Does anybody know what I'm doing wrong cause i did split the two as well and still gets the same issue it shows when Yes, end time stayswen no.
--Function Part---
var zovertime_fld;
var zovertime_fldnum;
function checkzovertime()
{
// var zovertime = document.getElementsById("df_12_3");
var zovertime = document.getElementsByName("SET.return_to_service")[0].options[document.getElementsByName("SET.return_to_service")[0].selectedIndex].value;
if ( typeof zovertime_fld == "undefined" ) {
zovertime_fld = findFieldAndLabelFromTable("zovertime_start_time","zovertime_end_time",1);
}
if (zovertime == '1'){
alert ("Fill in the Overtime period");
if ( zovertime_fld != null ) {
_dtl.fieldToValidate[zovertime_fldnum].is_required = 1;
zovertime_fld[0].style.display = "block";
zovertime_fld[1].style.display = "block";
}
}
else {
if ( zovertime_fld != null ) {
_dtl.fieldToValidate[zovertime_fldnum].is_required = 0;
zovertime_fld[0].style.display = "none";
zovertime_fld[1].style.display = "none";
}
}
}
----Return Service field----
<PDM_MACRO name=dtlDropdown hdr="Overtime" attr="return_to_service" autofill="no" evt="onBlur=\\\"checkzovertime()\\\"" lookup="no" make_required="no" size="10">
----zOvertime fields script-----
<PDM_MACRO name=dtlDate hdr="Overtime Start Time" attr="zovertime_start_time" make_required="yes">
zovertime_fldnum = _dtl.fieldToValidate.length - 1;
<PDM_MACRO name=dtlDate hdr="Overtime End Time" attr="zovertime_end_time" make_required="yes">
zovertime_fldnum = _dtl.fieldToValidate.length - 1;
<PDM_MACRO name=dtlStartRow>
if ( typeof zovertime_fld == "undefined" ) {
zovertime_fld = findFieldAndLabelFromTable("zovertime_start_time","zovertime_end_time",1);
}
if ("$args.return_of_service" == "1" || "$args.return_of_service" == "YES") {
if ( zovertime_fld != null ) {
_dtl.fieldToValidate[zovertime_fldnum].is_required = 1;
zovertime_fld[0].style.display = "block";
zovertime_fld[1].style.display = "block";
}
}
else {
if ( zovertime_fld != null ) {
_dtl.fieldToValidate[zovertime_fldnum].is_required = 0;
zovertime_fld[0].style.display = "none";
zovertime_fld[1].style.display = "none";
}
}
<PDM_ELSE>
<PDM_MACRO name=dtlReadonly hdr="Overtime Start Time" attr="zovertime_start_time">
<PDM_MACRO name=dtlReadonly hdr="Overtime End Time" attr="zovertime_end_time">
</PDM_IF>
I understand this is a custom but if anybody can just look at it to see what I'm doing wrong like I said does hid the start time, but not the end time.
I have attached how it looks on the screen and added the xx_service_outage_tab.htmpl. we changed the is screens a lot, but it should be the reason for the end time not disappearing.
I have another way we did it baut still do not hide the end date. if you to them one at time it works.
Please help
Edgar Louw