Documentation

HDResponse

Object representing the server's response.

Object Properties & Methods

 formThe form fields to be returned to the client.
 headersThe HTTP headers returned in the response.
 redirectRedirect the client to a new page.
 setCookieSet a client-side cookie value.
 skipPageRenderSkip the rendering of any HTML page objects.
 writeWrite information to the server output.

form

PropertyFirst available in version 1.0.0

A JavaScript object containing the value of each form field to be returned to the client. The client-side form fields will automatically synchronize their values with this array when the page loads. Values set in the form property will override anything set in the object's value property at design-time.

By default, the property is initialized with the form values from the request object.

Example:

// Set the value of the textbox1 form field
response.form["textbox1"] = "The new value";

headers

PropertyFirst available in version 1.0.0

A JavaScript object containing the HTTP headers to be returned in the response.

Example:

// set a response header
response.header["Content-type"] = "text/xml";

redirect

MethodFirst available in version 1.0.0

The redirect method redirects the client from the current page to a new one.

Usage:

response.redirect(pageID);

Arguments:

pageIDThe identifier of the destination page. (string) Alternately, pass a standard URL string to direct the user to an arbitrary location.
parameters(Optional) A JavaScript object containing the parameters to pass to the new page.

Note: any data written to the output using the response.write() method is discarded, but HTTP headers set in the response.headers Also, execution of the onGET or onPOST event handler is not automatically terminated by the response.redirect() method. In most cases the redirect should be followed by a return so the event handler doesn't continue executing.

Example:

function page1_onGET(request, response)
{
	if(request.form["field1"] == "something")
	{
		// redirect
		response.redirect("page2");
		return;
	}
}

setCookie

MethodFirst available in version 1.0.0

Sets a client-side cookie value. You can retrieve the value of a previously set cookie using the cookie(name) method of the HDRequest object.

Usage:

response.setCookie(name, value);

Arguments:

nameThe name of the cookie to be set. (string)
valueThe value to set. (string)

Example:

// Set the cookie "theCookieName" to the value "new value".
response.setCookie("theCookieName", "new value");

skipPageRender

PropertyFirst available in version 1.0.0

When set to true, the skipPageRender property causes the response to skip the rendering of any HTML page objects. The only output that will be sent to the client will be data written using the response.write() method.

Example:

function page1_onGET(request, response)
{
	// generate a simple XML document
	response.skipPageRender = true;
	response.headers["Content-type"] = "text/xml";
	
	response.write('\n');
	response.write('\n');
	response.write('Gambardella, Matthew\n');
	response.write('XML Developer Guide\n');
	response.write('Computer\n');
	response.write('44.95\n');
	response.write('2000-10-01\n');
	response.write('An in-depth look at creating applications with XML.\n');
	response.write('\n');
	response.write('\n');
}

write

MethodFirst available in version 1.0.0

The write(data) method writes data to the server output.

Usage:

response.write(data);

Arguments:

dataThe data to be written. (string)

Example:

// Write some HTML markup to the server's output:
response.write("
    "); response.write("
  • Item 1
  • "); response.write("
  • Item 2
  • "); response.write("
  • Item 3
  • "); response.write("
");

Copyright © 2010-2017, Handheld Designer, LLC, All Rights Reserved.
Made by hand in New England, USA.