Search these areas:
Help
Support Forums
Product Info



Introduction
DataWeb: What's New
Creating an Application
The DataWeb Designer
Application Management
Data Tables
Data Tables
Views
Templates
Components
Data Analysis
Members
Security
Importing
Exporting
FTP
JavaScript
Object Model
JavaScript Objects
General Scripting Objects
-Classes Object
-Email Object
-Request Object
-Response Object
addCookie
addFieldError
addHeader
addMessage
clearFieldError
decodeURL
clearFieldErrors
clearMessage
clearMessages
encodeHTML
encodeURL
getFieldError
getFieldErrorCount
getFieldErrors
getMessage
getMessageCount
getMessages
getTarget
hasFieldErrors
hasMessages
removeCookie
setContentType
setRedirect
setReshow
setTarget
throwRedirect
write
-Script Object
Data Access Objects
File Access Objects
Http Client Objects
Security and Membership Objects
Document Object Model (DOM)
Error Descriptions
Object Model Extensions
Full-Text Search
Domain and Email Hosting
HotBlock Modules
Account Management
Glossary
New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

DataWeb User's Guide

Response Object
The Response object represents the response that a DataWeb application returns to the user when the server has finished processing the request. (The Response object should not be confused with the HttpResponse object, which represents responses from web servers generally.) Typically the Response object is used to redirect the browser to a different page or to display error information to the user.

One Response object exists for each request made to the server. You refer to the Response object directly, without creating a new instance of it.

To force a redirect, call the setTarget() or the setRedirect() method. When the script exits, either through a return call or through normal completion, the client will be redirected according to the redirection mode parameter. In the case where the mode parameter equals MODE_DEFAULT, no special redirection takes place. Alternatively, the throwRedirect() method may be used to perform redirection immediately without waiting for the script to exit. This should be used for script that is run inside a view.

Note: Redirection is not validated in any way. The redirect will occur even if the redirect parameter does not specify a valid URL.

To handle user errors when receiving form data, call the addFieldError() method. Then call either setTarget(Response.MODE_RESHOW) or setReshow() to reshow the form. When the script exits, the browser will be redirected back to the original form submitted, with error information displayed next to the appropriate fields.

Note that if you handle user errors in the BeforeInsert, BeforeUpdate, or BeforeDelete method in a data class, you must cancel out of the script when an error occurs in order to prevent the database operation from occurring. To cancel the database operation, include return false; in the data table script.

Instance Methods

addCookie Adds a new cookie to the cookie header of the response.
addFieldError Adds an error to the response's error collection.
addHeader Adds to the response header.
addMessage Adds a message to the current response's message collection.
clearFieldError Removes the field error from the field error collection.
clearFieldErrors Resets the field error collection, clearing all field errors.
clearMessage Removes a key/message pair.
clearMessages Resets the message collection, clearing all messages.
decodeURL Returns the URL todecode_string argument decoded, i.e., formatted for readable display. For example, "%20" is replaced with a space, "%2C" is replaced with a comma, etc.
encodeHTML Returns the toencode_string parameter escaped as HTML. Line breaks are replaced with tags, less-than signs are replaced with '<', etc. The optional encode_whitespace argument indicates that spaces and line breaks should be encoded as well; default is FALSE.
encodeURL Returns the toencode_string argument, escaped for use in a URL. Spaces are replaced with "%20", commas are replaced with "%2C", etc. If the optional parameters_object argument is provided, the name/value pairs will be escaped and concatenated onto the URL string as parameters.
getFieldError Returns a string containing the error text associated with the specified field on the specified table, if such a field and table are found in the collection. Returns the empty string if the requested field error is not found.
getFieldErrorCount Returns the number of field errors in the response's field error collection.
getFieldErrors Returns a scripting object containing one property for each field error on the specified table.
getMessage Returns a string value containing the message string associated with the specified key, if such a key is found in the collection. Returns the empty string if the requested key is not found.
getMessageCount Returns the number of messages in the response's message collection.
getMessages Returns a scripting object containing one property for each message in the request's message collection.
getTarget Returns an object containing properties for target mode and data.
hasFieldErrors Checks to see if there are errors in the response's field errors collection.
hasMessages Checks to see if there are messages in the message collection.
removeCookie Removes a cookie from the response.
setContentType Sets the value of the "content-type" header in the response.
setRedirect Shortcut method for calling setTarget(Response.MODE_REDIRECT, URL). Note that to redirect from inside a view, you must use throwRedirect().
setReshow setReshow() will redisplay a user submitted form with any added field errors associated with fields displayed in that form.
setTarget Sets the next page that the browser will display.
throwRedirect Sets the redirect string to the specified URL_string and throws a Response.Errors.Redirect exception.
write Writes to the HTML output stream.

Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
Email Us