hasParameter (XSPUrl - JavaScript)

Checks if a query string parameter exists.

Defined in

XSPUrl (JavaScript)

Syntax

hasParameter(name:string) : boolean
Parameters Description
name The name of a possible parameter.
Return value Description
boolean True if the parameter exists.

Example

This example gets the value of a parameter if it exists.
function p(stuff) {
	print("<<<" + stuff + ">>>");
}

var url : XSPUrl;

try {
	url = context.getUrl();
	if(url.hasParameter("action")) {
		p("action = " + url.getParameter("action"));
	} else {
		p("no \"action\" parameter");
	}

} catch(e) {
	p("Error = " + e);

Print output from the example is as follows if the parameter exists:

<<<action = openDocument>>>