You are on page 1of 2

function ValidateLogFields(logdetails) { var invalidLogType = IsInvalidSelect(logdetails.logtypeid); if (contactTypes.is(':visible')) { invalidContactType = IsInvalidSelect(logdetails.

contacttypeid); } else { invalidContactType = false; } var invalidTrainingContent; var invalidTrainingDuration; var invalidNumberTrained; if (divTraining.is(':visible')) { invalidTrainingDuration = !((logdetails.TrainingDuration * 1) > 0); invalidNumberTrained = !((logdetails.NumberTrained * 1) > 0); } else { invalidTrainingDuration = false; invalidNumberTrained = false; } invalidTrainingContent = (invalidTrainingDuration && invalidNumberTraine d); var invalidCustomerName = (divCustomers.css('display') != 'none') && IsI nvalidSelect(logdetails.customerno); var invalidEndUserName = (divEndUser.css('display') != 'none') && IsInva lidSelect(logdetails.enduserno); var invalidLogSubject = IsEmpty(logdetails.logsubject); var invalidExecutiveSummary = IsEmpty(logdetails.executivesummary); //var invalidHighLights = IsEmpty(logdetails.highlights); var firstScreenInFocus = divLogDetail1.is(':visible'); var secScreenInFocus = divLogDetail2.is(':visible'); var thirdScreenInFocus = !(firstScreenInFocus || secScreenInFocus); var var var var var var var valMsgLogType = $("#valMsgLogType"); valMsgContactType = $("#valMsgContactType"); valMsgCustomerName = $("#valMsgCustomerName"); valMsgEndUser = $("#valMsgEndUserName"); valMsgLogSubject = $("#valMsgLogSubject"); valMsgExecutiveSummary = $("#valMsgExecutiveSummary"); valMsgHighlights = $("#valMsgHighlights");

var valMsgTrainingDuration = $('valMsgTrainingDuration'); var valMsgNumberTrained = $('valMsgNumberTrained'); valMsgLogType.hide(); valMsgContactType.hide(); valMsgCustomerName.hide(); valMsgEndUser.hide(); valMsgLogSubject.hide(); valMsgExecutiveSummary.hide(); valMsgTrainingDuration.hide(); valMsgNumberTrained.hide(); valMsgHighlights.hide();

var firstScreenValFailed = (invalidLogType || invalidContactType || inva lidTrainingContent || invalidCustomerName || invalidEndUserName); var secScreenValFailed = (invalidLogSubject || invalidExecutiveSummary); //|| invalidHighLights); if (firstScreenInFocus) { if (firstScreenValFailed) { if (invalidLogType) { valMsgLogType.show(); } if (invalidContactType) { valMsgContactType.show(); } if (invalidCustomerName) { valMsgCustomerName.show(); } if (invalidEndUserName) { valMsgEndUser.show(); } if (invalidTrainingDuration) { valMsgTrainingDuration.show(); } if (invalidNumberTrained) { valMsgNumberTrained.show(); } } else { if (secScreenValFailed) { Navigate(2); // if (invalidHighLights) { valMsgHighlights.show(); } if (invalidLogSubject) { valMsgLogSubject.show(); } if (invalidExecutiveSummary) { valMsgExecutiveSummary.show() ; } } } } else { if (secScreenValFailed) { if (invalidHighLights) { valMsgHighlights.show(); } if (invalidLogSubject) { valMsgLogSubject.show(); } if (invalidExecutiveSummary) { valMsgExecutiveSummary.show(); } } else { if (firstScreenValFailed) { Navigate(1); if (invalidLogType) { valMsgLogType.show(); } if (invalidContactType) { valMsgContactType.show(); } if (invalidCustomerName) { valMsgCustomerName.show(); } if (invalidEndUserName) { valMsgEndUser.show(); } if (invalidTrainingDuration) { valMsgTrainingDuration.show() ; } if (invalidNumberTrained) { valMsgNumberTrained.show(); } } } } return !(firstScreenValFailed || secScreenValFailed); }