1 Reply Latest reply on Mar 15, 2014 1:07 AM by nsw2206

    Javascript ELSE not working

    zjaffary

      Hi

       

      I  have abobe form and using the following javascript to change the Applicant Title with different value.

      if there is Applicant or Co signer it will replace with "Applicant (s). but if the there is Guarantor then it will change to "Guarantor (s). this condition is in Else statement.

       

      But when i run it only change for Applicant or Co signer not working else condition for Guarantor.

       

      Can any one help me out? please the the following code.

       

      Thanks 

        

      var tApplicant  = "Applicant(s):";
      var tGuarantor  = "Guarantor(s):";
      var oSubform    = SummarySection.Summary.SummaryBody.Applicants.ApplicantNameBody;
      var nFormLength = oSubform.nodes.length;
      if (this.applicantGroupTypeDd.rawValue == null)
      { this.presence = 'hidden'; }
      else {
       if (this.applicantGroupTypeDd.rawValue == "Applicant" || this.applicantGroupTypeDd.rawValue == "0" || this.applicantGroupTypeDd.rawValue == "Co Signer" || this.applicantGroupTypeDd.rawValue == "1")
       {
      //The following set the caption on the salutation, this has been replaced with a proper title
      //xfa.resolveNode("this.applicant.applicant.name.salutationDd.caption.value.#text").value = "Applicant(s):" ;
        this.applicantGroupTypeTitle.rawValue = tApplicant ;
      //The following will update the title in the summary area
        for (var nCount = 0; nCount < nFormLength; nCount ++) {
         if (oSubform.nodes.item(nCount).name == "name") {
          var oForm = oSubform.nodes.item(nCount);
          if (oForm.applicantGroupTypeTitle.rawValue == "   " ) {
           oForm.applicantGroupTypeTitle.rawValue = tApplicant; 
           tApplicant = "      "; 
          }
         }
        }
       } else if (this.applicantGroupTypeDd.rawValue == "Guarantor" )
       {
      //xfa.resolveNode("this.applicant.applicant.name.salutationDd.caption.value.#text").value = "Guarantor(s):" ; }
        this.applicantGroupTypeTitle.rawValue = tGuarantor ;
      //The following will update the title in the summary area
        for (var nCount = 0; nCount < nFormLength; nCount ++) {
         if (oSubform.nodes.item(nCount).name == "name") {
          var oForm = oSubform.nodes.item(nCount);
          if (oForm.applicantGroupTypeTitle.rawValue == "   " ) {
           oForm.applicantGroupTypeTitle.rawValue = tGuarantor; 
           tGuarantor = "      ";
          }
         }
        }
       }
      }