//... Determine form to be used for dialog box - dependent on browser & dialog box required. function init(){ document.getElementById("CNameError").style.display="none"; var SectionNo =parseInt(window.document.forms[0].SectionNo.value); for (var i = 10; i <= 50 && i <= SectionNo; i=i+5) { document.getElementById("Section"+i).style.display=""; } } function determinscreen(dialog) { // alert("dialog : "+dialog); if( dialog == "snglOKCancelList" ) { // alert("dialog : "+dialog); '3/9/02 SMB // browser = (navigator.appName == 'Microsoft Internet Explorer' && navigator.appVersion.indexOf('3') > -1) ? '$ie3' : '$nn'; return '$nn'; } else { // browser = (navigator.appName == 'Microsoft Internet Explorer' && navigator.appVersion.indexOf('3') > -1)? '$ie3' : '$nn2'; return '$nn2' } //return browser; ; } //... Open dialog box function dialogBox( fieldName, dialog) { // alert("starting dialogBox function"); if (dialog == 'MB_OKCancel') { abURL = "/" + document.forms[0].dbPath.value + "/dlgProviderNameWeb?OpenForm&key=" + fieldName; addressField = fieldName; wheight = "175"; wwidth = "550"; } else { browser = determinscreen(dialog); abURL = "/" + document.forms[0].dbPath.value + "/AddressBox" + browser + "?OpenForm&key=" + fieldName; addressField = fieldName; wheight = ( browser == "$ie3") ? "200" : "350"; wwidth = ( browser == "$ie3") ? "550" : "720"; } opts = "width=" + wwidth + ",height=" + wheight; popupWin=window.open( abURL,"abWindow", opts); } //... Verify Text field function verifnull(namefield) { if (eval('document.forms[0].' + namefield)) { Preciser_Text = eval('document.forms[0].' + namefield + '.value'); if ( Preciser_Text == "" ) { eval('document.forms[0].' + namefield + '.focus()'); return false } else return true; } else return true; } var messglobal=""; function verifformgeneral() { test="yes"; messglobal = "" //alert ("Checking cname"); document.getElementById("CNameError").style.display="none"; if (!(verifnull("CName"))) { document.getElementById("CNameError").style.display=""; //messglobal = "A course name must be entered. " +"\n"; test= "no";} //check the provider //alert ("Check provider"); document.getElementById("CProviderError").style.display="none"; if (validatelistbox("CProvider")=='false') { // messglobal=messglobal+ "The name of a training provider must be entered. "+"\n"; document.getElementById("CProviderError").style.display=""; if (test=='yes'){ eval('document.forms[0].CProvider' + '.focus()');} test= "no"; } //check the knowledge //alert ("check knowledge"); document.getElementById("CKnowledgeError").style.display="none"; if (validatecheckbox("CKnowledge1") == 'false') { if (validatecheckbox("CKnowledge2") =='false') { document.getElementById("CKnowledgeError").style.display=""; // messglobal=messglobal+"At least one specialist knowledge deriving from this course must be selected. " +"\n"; if (test=='yes'){ eval('document.forms[0].CProvider' + '.focus()');} test= "no"; } } //validate if tier is selected // alert ("check tier"); document.getElementById("CTierError").style.display="none"; if (validateradiobutton("CTier")=='false') { //messglobal=messglobal + "The course tier level must be identified. " + "\n"; document.getElementById("CTierError").style.display=""; if (test=='yes'){ eval('document.forms[0].CProvider' + '.focus()');} test = "no";} /* Validation removed tempoariliy after conversation with Jenny Green, will be reinstated at a later date. (SMB 6/9/02) * messglobal=verifnull("CLocation", "At least one course location must be selected. ",messglobal); * if(!(messglobal=="")) test= "no"; */ //check the knowledge // alert ("check cdelivery"); document.getElementById("CDeliveryError").style.display="none"; if (validatecheckbox("CDelivery1") == 'false') { if (validatecheckbox("CDelivery2") =='false') { //messglobal=messglobal+"The delivery method must be selected. " +"\n"; document.getElementById("CDeliveryError").style.display=""; if (test=='yes'){ eval('document.forms[0].CProvider' + '.focus()');} test= "no"; } } //alert ("check startdate"); document.getElementById("CStartDateError").style.display="none"; errmsg = ValidateDateField("CStartDateE"); if(!(errmsg=="")) { // messglobal=messglobal+ errmsg + " for Start Date."+"\n"; document.getElementById("CStartDateError").style.display=""; if (test=='yes'){ eval('document.forms[0].CStartDateE' + '.focus()');} test= "no";} //alert ("check end date"); document.getElementById("CEndDateError").style.display="none"; errmsg = ValidateDateField("CEndDateE"); if(!(errmsg=="")) { document.getElementById("CEndDateError").style.display=""; //messglobal=messglobal+ errmsg+" for End Date. \n"; if (test=='yes'){ eval('document.forms[0].CEndDateE' + '.focus()');} test= "no";} //validate reregistration date isNewDoc = document.forms[0].IsNewDoc.value; if(isNewDoc=="N") { document.getElementById("CStartDate1Error").style.display="none"; document.getElementById("CEndReasonError").style.display="none"; document.getElementById("CEndReasonOtherError").style.display="none"; document.getElementById("CEndReasonOtherError1").style.display="none"; startdate1 =document.forms[0].CStartDate1E.value; errmsg = ValidateDateField("CStartDate1E"); if (!(errmsg=="")) { document.getElementById("CStartDate1Error").style.display=""; if (test=='yes'){ eval('document.forms[0].CStartDate1E' + '.focus()'); test= "no";} } //else { errmsg1 = validateEndReason(test); if(!(errmsg1=="")) { if (test=='yes'){ test= "no";} } // } } //validate if other is specified //alert ("validate assessmentype"); if (validatecheckaassessmenttype("CAssessment1") == 'false') { document.getElementById("CAssessmentOtherError").style.display=""; if (test=='yes'){ eval('document.forms[0].CAssessmentOther' + '.focus()');} test= "no"; } //validate if other is specified //alert ("validate assessmentype"); if (validatecheckaassessmenttype("CAssessment2") == 'false') { document.getElementById("CAssessmentOtherError").style.display=""; if (test=='yes'){ eval('document.forms[0].CAssessmentOther' + '.focus()');} test= "no"; } //validate if cost is numeral //alert ("Check cost"); cost_Text = document.forms[0].CCost.value; document.getElementById("CCostError").style.display="none"; if (!(cost_Text=="")) { if (!( isInteger(cost_Text))){ //messglobal=messglobal+ "Please enter numeric value for cost." +"\n"; document.getElementById("CCostError").style.display=""; if (test=='yes'){ eval('document.forms[0].CCost' + '.focus()');} test= "no";} } //validate duration //alert ("Check duration"); duration_Text = document.forms[0].CDuration.value; document.getElementById("CDurationError").style.display="none"; if (!(duration_Text=="")) { if (!( isInteger(duration_Text))){ // messglobal=messglobal+ "Please enter numeric value for duration." +"\n"; document.getElementById("CDurationError").style.display=""; if (test=='yes'){ eval('document.forms[0].CDuration' + '.focus()');} test= "no";} } //validate if hrs are all entered properly //alert ("check topics"); errmsg = checktopics(test); if (!(errmsg=="")) { // messglobal = messglobal + errmsg; test = "no";} //validate prof association //alert ("check prof association"); //errmsg =profassoc(test); if (!(errmsg=="")) { //messglobal = messglobal + errmsg; test = "no";} //alert (test); if (!(test=="no")){ return true } else { document.getElementById("CourseError").style.display=""; // alert("The document contains the following errors : " + "\n" + messglobal); // messglobal=""; return false; } } function verifformprovider() { messglobal=""; test = "yes"; if (!verifnull("PProvider")) { document.getElementById("PProviderError").style.display=""; //messglobal="A provider name must be entered. "; test ="no"; } if (test=="yes"){ return true; } else { // alert(messglobal); return false; } } //...Update ReviewerLog field function updatelog() { today = new Date(); var frm = document.forms[0]; if (eval('frm.PersonName')) { Person = eval('frm.PersonName.value'); if (eval('frm.ReviewLog')) { Log = eval('frm.ReviewLog.value'); if (Log == "") newLog = "Created by " + Person + " on " + today.toLocaleString() + "."; else newLog = Log + "\n Updated by " + Person + " on " + today.toLocaleString() + "."; frm.ReviewLog.value = newLog; } } } //test date input function isInteger(s){ var i; for (i = 0; i < s.length; i++){ // Check that current character is number. var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } // All characters are numbers. return true; } function stripCharsInBag(s, bag){ var i; var returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length; i++){ var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function daysInFebruary (year){ // February has 29 days in any year evenly divisible by four, // EXCEPT for centurial years which are not also divisible by 400. return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 ); } function DaysArray(n) { for (var i = 1; i <= n; i++) { this[i] = 31 if (i==4 || i==6 || i==9 || i==11) {this[i] = 30} if (i==2) {this[i] = 29} } return this } function isDate(dtStr,namefield){ var dtCh= "/"; var minYear=1900; var maxYear=2200; var daysInMonth = DaysArray(12) var pos1=dtStr.indexOf(dtCh) var pos2=dtStr.indexOf(dtCh,pos1+1) var strDay=dtStr.substring(0,pos1) var strMonth=dtStr.substring(pos1+1,pos2) var strYear=dtStr.substring(pos2+1) var errormsg = ""; strYr=strYear if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1) if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1) for (var i = 1; i <= 3; i++) { if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1) } month=parseInt(strMonth) day=parseInt(strDay) year=parseInt(strYr) if (pos1==-1 || pos2==-1){ errormsg="The date format should be : dd/mm/yyyy" ; return errormsg; } if (strMonth.length<1 || month<1 || month>12){ //alert("error in month"); errormsg="Please enter a valid month"; return errormsg; } if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){ errormsg="Please enter a valid day"; return errormsg; } if (strYear.length != 4 || year==0 || yearmaxYear){ errormsg ="Please enter a valid 4 digit year between "+minYear+" and "+maxYear ; return errormsg; } if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){ errormsg="Please enter a valid date"; return errormsg; } return errormsg; } function ValidateDateField(namefield){ var errormsg = ""; date_Text = eval('document.forms[0].' + namefield + '.value'); if (!(date_Text=="")) { errormsg =isDate(date_Text,namefield); } return errormsg; } function validatecheckbox(namefield) { //**alert ("checking check box"); chk = 'false'; var frm = window.document.forms[0]; for (var m=0; m < eval ('frm.'+namefield+'.length') ; m++) { if ( eval ( 'frm.'+namefield+'['+m +'].checked') ) { chk = 'true'; } //Closes the if } //Closes the for Loop // if (chk=='false') { // eval('document.forms[0].' + namefield + '.focus()');} return chk } function validatecheckaassessmenttype(namefield) { chk = 'true'; var frm = window.document.forms[0]; for (var m=0; m < eval ('frm.'+namefield+'.length') ; m++) { if ( eval ( 'frm.'+namefield+'['+m +'].checked') ) { tmp = eval( 'frm.'+namefield+'['+m +'].value'); if (tmp == "Other") { if (frm.CAssessmentOther.value =="") { chk ='false'} } } //Closes the if } //Closes the for Loop return chk } function validatelistbox(namefield) { chk = 'false'; var frm = window.document.forms[0]; if ( eval ( 'frm.'+namefield+'.options[frm.'+namefield+'.selectedIndex].text') !='' ) { chk = 'true'; } //Closes the if return chk } function getlistboxselection(namefield) { //alert ("getting value of " + namefield); value = ''; var frm = window.document.forms[0]; if ( eval ( 'frm.'+namefield+'.options[frm.'+namefield+'.selectedIndex].text') !='' ) { value = eval ( 'frm.'+namefield+'.options[frm.'+namefield+'.selectedIndex].text') //alert(value); } //Closes the if return value } function validateradiobutton(namefield) { //alert ("checking radio button routine"); //alert (namefield); chk = 'false'; var frm = window.document.forms[0]; for (var m=0; m < eval ('frm.'+namefield+'.length') ; m++) { if ( eval ( 'frm.'+namefield+'['+m +'].checked') ) { chk = 'true'; // alert ("one is checked"); } //Closes the if } //Closes the for Loop // if (chk=='false'){ eval('document.forms[0].' + namefield + '.focus()');} return chk } function checktopics(test ) { //alert ("at the function checktopics"); chk = 'false'; errormsg = ""; var frm = window.document.forms[0]; SectionNo =parseInt(window.document.forms[0].SectionNo.value)+1; //alert (SectionNo); //alert ("new code"); for (var m=1; m 0)."+"\n"; document.getElementById("TopicHrsFace"+m+"Error").style.display=""; if (test=='yes'){ eval('document.forms[0].TopicHrsFace' + m+ '.focus()');} test ="no"; } } //'check if hrs for Assg is integer if (TopicHrsAssg=="") {if (!(Topic=="")) {eval('frm.' + "TopicHrsAssg"+m + '.value = 0');}} else { if (!( isInteger(TopicHrsAssg))){ errormsg = errormsg + "Assignment hours for Topic " + m + " should be numeric (hrs =>0).\n"; document.getElementById("TopicHrsAssg"+m+"Error").style.display=""; if (test=='yes'){ eval('document.forms[0].TopicHrsAssg' + m+ '.focus()');} test ="no";}} //check if hrs for Self Study if (TopicHrsSelfStudy=="") {if (!(Topic=="")) {eval('frm.' + "TopicHrsSelfStudy"+m + '.value = 0');}} else { if (!( isInteger(TopicHrsSelfStudy))){ errormsg = errormsg + "Self Study hours for Topic " + m + " should be numeric (hrs =>0)\n."; document.getElementById("TopicHrsSelfStudy"+m+"Error").style.display=""; if (test=='yes'){ eval('document.forms[0].TopicHrsSelfStudy' + m+ '.focus()');} test ="no"; } // } } //end if topic is >1 }//end of for loop return errormsg } //end of function function profassoc(test ) { //alert ("at the function checprofassoc"); chk = 'false'; errormsg = ""; var frm = window.document.forms[0]; //define the array for var ProfList = new Array(); ProfList[0] ="Financial Planning Association (FPA)"; ProfList[1] = "Investments and Financial Services Association (IFSA)"; ProfList[2] = "National Insurance Brokers Association (NIBA)"; ProfList[3] = "Securities and Derivatives Industry Association (SDIA)"; ProfList[4] = "Assocation of Financial Advisers (AFA)"; ProfList[5] = "Insurance Advisers Association of Australia (IAAA)"; ProfList[6] = "Insurance Council of Australia (ICA)"; ProfList[7] = "Boutique Financial Planning Principals Group"; ProfList[8] = "Association of Superannuation Funds of Australia (ASFA)"; ProfList[9] = "Medical Indemnity Industry Association of Australia"; ProfList[10] = "Australian Bankers' Association (ABA)"; ProfList[11] = "Abacus - Australian Mutuals"; ProfList[12] = "CPA Australia"; ProfList[13] = "National Institute of Accountants (NIA)"; ProfList[14] = "Institute of Chartered Accountants in Australia (ICAA)"; for (var m=1; m <16 ; m++) { CRecogType =getlistboxselection('CRecogType'+m); CRecogOther =eval('frm.' + 'CRecogOther'+m + '.value'); CProfAssoc = ProfList[m-1]; // alert ("m newis "+m); // alert ("typeis = "+CRecogType); //alert ("typeother is =" +CRecogOther); namefield = "CProfAssoc"+m; document.getElementById("CRecogType"+m+"Error").style.display="none"; document.getElementById("CRecogOther"+m+"Error").style.display="none"; if (! (eval( 'frm.CProfAssoc'+m+ '.checked') )) { if (!(CRecogType=="")) { errormsg = errormsg + "Type of recognition is specified for " + CProfAssoc + " but the association is not selected. \n"; document.getElementById("CRecogType"+m+"Error").style.display=""; if (test=='yes'){ eval('document.forms[0].CRecogType' + m+ '.focus()');} test ="no"; } if (!(CRecogOther=="")) { errormsg = errormsg + "Type of other recognition is specified for " + CProfAssoc + " but the association is not selected. \n"; document.getElementById("CRecogType"+m+"Error").style.display=""; if (test=='yes'){ eval('document.forms[0].CRecogOther' + m+ '.focus()');} test ="no"; } } else { if (CRecogType=="Other") { if (CRecogOther == "") { errormsg = errormsg + "Please specify other recognition for " + CProfAssoc + " \n"; document.getElementById("CRecogOther"+m+"Error").style.display=""; if (test=='yes'){ eval('document.forms[0].CRecogOther' + m+ '.focus()');} test ="no"; }} else {if (!(CRecogOther == "")) { eval('frm.' + "CRecogOther"+m + '.value = "" ');} } } }// end of for loop return errormsg }// end function function validateEndReason(test) { errormsg = ""; EndDate = document.forms[0].CEndDateE.value; EndReason = getlistboxselection('CEndReason'); EndReasonOther =document.forms[0].CEndReasonOther.value; if (EndDate =="") { if (!(EndReason=="")) { document.getElementById("CEndReasonError").style.display=""; errormsg = "Reason for de-registration is entered but no date is specified"; if (test =="yes") { eval('document.forms[0].CEndReason' + '.focus()'); } } if (!(EndReasonOther=="")) { document.getElementById("CEndReasonOtherError1").style.display=""; errormsg = "Othe reason for de-registration is entered but no date is specified"; if (test =="yes") { eval('document.forms[0].CEndReasonOther' + '.focus()');} } } else { if(EndReason=="Other") { if (EndReasonOther=="") { document.getElementById("CEndReasonOtherError").style.display=""; errormsg = "Please specify other reason for de-registration" if (test =="yes") { eval('document.forms[0].CEndReasonOther' + '.focus()'); } } } else { if (!(EndReasonOther=="")) {document.forms[0].CEndReasonOther.value=""; }} } return errormsg } function IncrementTopic() { var frm = window.document.forms[0]; //alert ("incrementing topic"); SectionNo =parseInt(window.document.forms[0].SectionNo.value)+5; document.getElementById("Section"+SectionNo).style.display=""; //alert ("unhiding topics"); //alert (SectionNo); if (SectionNo >46){document.getElementById("AddButton").style.display="none";} frm.SectionNo.value = SectionNo; SectionNo = SectionNo - 4; eval('document.forms[0].' + "Topic"+SectionNo + '.focus()'); }