JavaScript

{dialog.object}submit Method

Syntax

{dialog.Object}.submit([submitType [,additionalData [,optionsObject]]])

Arguments

submitTypestring

Custom submit type. Lets you compare different submit values, if there are multiple buttons on a UX that use submit(). The submit type can be any desired value.

additionalDatastring

Additional data to be submitted in the form of a URL query string.

optionsObjectJSON object

A JSON Object with additional information. The following options can be specified:

flagSaveListDataboolean

A true/false value. If true, list data is submitted to the server.

deviceOfflineFunctionfunction

Function to call if the device is offline.

onCompletefunction

Function to call if the callback completes successfully.

submitFormDataboolean

A true/false value. If true, form data will be submitted from the component. Set to false if you do not want to submit form data.

getLocationDataboolean

A true/false value. Indicates if the location (latitude and longitude) should be fetched from the browser and submitted to the server.

The e object passed to server-side Xbasic events will contain the location in the following properties: __locationFound - true/false, __locationLatitude - the latitude value, and __locationLongitude - the longitude value.

Not all browsers support fetching the location.

enableHighAccuracyboolean

A true/false value. Indicates if high accuracy should be used when fetching the location. Using high accuracy will take longer and use more power.

timeoutnumeric

Amount of time to wait in milliseconds to fetch the location.

maximumAgenumeric

Maximum time in milliseconds to accept a previously fetched location. A value of 0 means that a new location must be fetched.

ajaxCallbackTimeoutnumeric

Maximum number of milliseconds to wait for a response from the server.

errorFunctionfunction

Function to call if an error occurs.

chunkedResponsesobject

An object with the following properties:

allowboolean

A true/false value. If true, chunked responses will be used.

maxMessagesnumeric

The maximum number of messages to listen for.

maxTimenumeric

The maximum number of seconds to listen for messages.

Description

Submits the UX to the server.

Discussion

The submit() method posts data from the UX component to the server via an ajax callback.

{dialog.Object}.submit();

You can optionally include a 'submitType'. If you have multiple buttons on the UX that call the .submit() method, by specifying the 'submitType' your code in the dialogValidate and afterDialogValidate event handlers could test the value of the submitType value.

{dialog.Object}.submit("save_customer");
{dialog.object}.submit("send_orders");

The submit type value is available in Xbasic server-side events for the UX component in the 'Request.Variables.__submitType' variable.

You can also optionally specify additional data to be submitted in the form of a URL query string. For example:

var additionalData = "value1=alpha&value2=beta";
{dialog.object}.submit("save",additionalData);

The additional data is available in 'Request.Variables' variable in the Xbasic server-side events for the UX component.

You can also pass additional options to the submit() method. For example:

var options = {getLocationData:true};
{dialog.object}.submit("","",options);

The getLocationData option indicates that location information from the browser should be submitted as part of the callback.

See Also