JS DESK

From FreeDESK
(Difference between revisions)
Jump to: navigation, search
(Created page with "= Overview = The FreeDESK Javascript object will always be available on any page instantiated as DESK. This provides most common functionality within the FreeDESK client-side...")

Revision as of 23:03, 27 June 2012

Contents

Overview

The FreeDESK Javascript object will always be available on any page instantiated as DESK.

This provides most common functionality within the FreeDESK client-side interface.

Common Functions and Examples

Logging In

Calling DESK.show_login() will show the login pop-over DIV and allow the user to login.

Logging Out

Calling DESK.logout_click() will simulate the user clicking on the logout button, clear the session and return to the main index.

Checking for Response Errors

XML data received from the API can be checked to see if it is a FreeDESK error using DESK.isError(xml) which will return a boolean value (true for an error false if not an error).

A descriptive string stating the error code and a textual description can be got from an error with DESK.getError(xml). Just the error code can be returned with DESK.getErrorCode(xml).

Loading a Subpage

To load a subpage (that is a page of text/html provided from the page.php script server-side) the function DESK.loadSubpage(pageid, options) can be called. Options are in URI format and are passed onto the page URL.

Opening a Window

A window can be opened (of default size) using DESK.openWindow(windowname, url).

Form to Query

A function is provided to turn a form into a suitable URI string for query (get) or post data. All the fields of the form are parsed into one string and returned.

For example a form of ID 'testform' containing a text input called 'A' with an inputted value of 'hello' and another text input of 'B' with a value of 'there' as follows:

<form id="testform">
<input type="text" name="A" value="hello">
<input type="text" name="B" value="there">
</form>
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox