Jump to content

Help with javascript call


dkizerian

Recommended Posts

this is 2 lines from a piece of sample code I'm trying to disect.

 

verify_level = this.req.responseXML.getElementsByTagName
      ("verifylevel")[0].firstChild.nodeValue;

 

it throws an "Object Required" error.

 

I'm just starting into this, and am a bit lost. Thanks - also, should this be in the AJAX section instead of here?

 

 

here is the entire function, if it helps.

 

business.processSearchResults = function(interaction)
{
var previous_verify_level = verify_level;
var previous_moniker = current_moniker;


verify_level = this.req.responseXML.getElementsByTagName
	("verifylevel")[0].firstChild.nodeValue;

if (interaction_verified == true){verify_level = "Verified";}

//  Check for a partial result with resolvable ranges (no picklist necessary)
	var j = 0;
        var i = 0;

    //    if (verify_level == "PremisesPartial" || verify_level == "StreetPartial")
      //  {
        //    var tempresults = business.parsePicklistResults(this.req);
          //  for (i=0;i<tempresults.length;i++)
            //{
                //alert(tempresults[i].isUnresolvableRange() + "\n\ri =" + i + "\n\rj=" + j);
              //  if (tempresults[i].isUnresolvableRange() == "False") {j++;}
            //}
             //   if (j == tempresults.length) { verify_level = "Multiple"; }
        //}

switch (verify_level)
{
	case "PremisesPartial":
		var results = business.parsePicklistResults(this.req);
		// If the result is single, force an interaction
		if (results[0].isFullAddress().toLowerCase() == "true")
		{
			if (results.length == 1)
			{
				var sservice = new com.qas.SearchService(
					business.processForcedInteraction,
					business.processSearchError);
				sservice.refine(results[0].getMoniker(),"");
				return;
			}
			// Special case - proweb occasionally returns a verified address with    ***This Code is addressed above with the single premise***
			// more than one result?? This handles that situation.   **this code would cause issues in specific refinement cases because the verify levels weren't changing
			//else if (previous_verify_level == verify_level)
			//{
			//	var sservice = new com.qas.SearchService(
			//		business.processSearchResults,
			//		business.processSearchError);
			//	sservice.refine(results[0].getMoniker(),"");
			//	return;
			//}
		}

		if (previous_verify_level == verify_level && results.length > 1)
		{
			interface.showPremPartialError();
			return;
		}
		interface.showPremPartialResults(business.parsePicklistResults(this.req));

		//  Check for a refine error and display message
		current_moniker = results[0].getMoniker();
		if (previous_moniker == current_moniker)
		{
			interface.showRefineError();
		}

		break;
	case "StreetPartial":
		var results = business.parsePicklistResults(this.req);
		// If the result is single, force an interaction
		if (results.length == 1 && results[0].isFullAddress().toLowerCase() == "true")
		{
			var sservice = new com.qas.SearchService(
				business.processForcedInteraction,
				business.processSearchError);
			sservice.refine(results[0].getMoniker(),"");
			return;
		}
		if (previous_verify_level == verify_level && results.length > 1)
		{
			interface.showStreetPartialError();
			return;
		}
		interface.showStreetPartialResults(business.parsePicklistResults(this.req));
		break;
	case "Verified":
		is_verified = true;
		interface.showVerifiedResults(business.parseSingleResult(this.req));
		interface.appendApt(business.parseSingleResult(this.req));
		events.handleThirdPartyButtonClick();
		interaction_verified = "";
		break;
	case "InteractionRequired":
		interface.showInteractionResults(business.parseSingleResult(this.req));
		break;
	case "Multiple":
		interface.showMultipleResults(business.parsePicklistResults(this.req));
		break;
	case "None":
		if (com.qas.IGNORE_UNMATCHED_ADDRESSES.toLowerCase() == "true")
		{
			interface.showVerifiedResults(originaladdress);
			events.submitForm();			
		}
		else
		{
			interface.showNoResults();
		}
		break;
	default : 
		break;
}
}

Link to comment
https://forums.phpfreaks.com/topic/109755-help-with-javascript-call/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.