You can use the following live data functions to mimic menu functionality:

  • The showLiveDataDialog() function is used for the View > Live Data Settings menu item.

  • The setLiveDataMode() function is used for the View > Live Data and View > Refresh Live Data menu items.

  • The getLiveDataMode() function determines whether Live Data mode is active.

You can use the remaining live data functions when you implement the translator API liveDataTranslateMarkup() function.

dreamweaver.getLiveDataInitTags()

Availability

Dreamweaver UltraDev 1.

Description

Returns the initialization tags for the currently active document. The initialization tags are the HTML tags that the user supplies in the Live Data Settings dialog box. This function is typically called from a translator’s liveDataTranslateMarkup() function, so that the translator can pass the tags to the liveDataTranslate() function.

Arguments

None.

Returns

A string that contains the initialization tags.

dreamweaver.getLiveDataMode()

Availability

Dreamweaver UltraDev 1.

Description

Determines whether the Live Data window is currently visible.

Arguments

None.

Returns

A Boolean value: true if the Live Data window is visible; false otherwise.

dreamweaver.getLiveDataParameters ()

Availability

Dreamweaver MX.

Description

Obtains the URL parameters that are specified as Live Data settings.

Live Data mode lets you view a web page in the design stage (as if it has been translated by the application server and returned). Generating dynamic content to display in Design view lets you view your page layout with live data and adjust it, if necessary.

Before you view live data, you must enter Live Data settings for any URL parameters that you reference in your document. This prevents the web server from returning errors for parameters that are otherwise undefined in the simulation.

You enter the URL parameters in name-value pairs. For example, if you reference the URL variables ID and Name in server scripts in your document, you must set these URL parameters before you view live data.

You can enter Live Data settings through Dreamweaver in the following ways:

  • Through the Live Data Settings dialog box, which you can activate from the View menu.

  • In the URL text field that appears at the top of the document when you click the Live Data View button on the toolbar.

    For the ID and Name parameters, you can enter the following pairs:

     ID 22 Name Samuel

    In the URL, these parameters would appear as shown in the following example:

     http://someURL?ID=22&Name=Samuel

    This function lets you obtain these live data settings through JavaScript.

Arguments

None.

Returns

An array that contains the URL parameters for the current document. The array contains an even number of parameter strings. Each two elements form a URL parameter name-value pair. The even element is the parameter name and the odd element is the value. For example, getLiveDataParameters() returns the following array for the ID and Name parameters in the preceding example: ['ID,'22','Name','Samuel'].

Example

The following example returns the parameters that are specified as Live Data settings and stores them in the paramsArray:

 var paramsArray = dreamweaver.getLiveDataParameters();

dreamweaver.liveDataTranslate()

Availability

Dreamweaver UltraDev 1.

Description

Sends an entire HTML document to an application server, asks the server to execute the scripts in the document, and returns the resulting HTML document. This function can be called only from a translator’s liveDataTranslateMarkup() function; if you try to call it at another time, an error occurs. The dreamweaver.liveDataTranslate()function performs the following operations:

  • Makes the animated image (that appears near the right edge of the Live Data window) play.

  • Listens for user input. If the Stop icon is clicked, the function returns immediately.

  • Accepts a single string argument from the caller. (This string is typically the entire source code of the user’s document. It is the same string that is used in the next operation.)

  • Saves the HTML string from the user’s document as a temporary file on the live data server.

  • Sends an HTTP request to the live-data server, using the parameters specified in the Live Data Settings dialog box.

  • Receives the HTML response from the live data server.

  • Removes the temporary file from the live data server.

  • Makes the animated image stop playing.

  • Returns the HTML response to the caller.

Arguments

string

  • A single string, which typically is the entire source code of the user’s current document.

Returns

An httpReply object. This object is the same as the value that the MMHttp.getText() function returns. If the user clicks the Stop icon, the return value’s httpReply.statusCode value is equal to 200 (Status OK) and its httpReply.data value is equal to the empty string. For more information on the httpReply object, see The HTTP API.

dreamweaver.setLiveDataError()

Availability

Dreamweaver UltraDev 1.

Description

Specifies the error message that appears if an error occurs while the liveDataTranslateMarkup() function executes in a translator. If the document that Dreamweaver passed to liveDataTranslate() contains errors, the server passes back an error message that is formatted using HTML. If the translator (the code that called liveDataTranslate()) determines that the server returned an error message, it calls setLiveDataError() to display the error message in Dreamweaver. This message appears after the liveDataTranslateMarkup() function finishes executing; Dreamweaver displays the description in an error dialog box. The setLiveDataError() function should be called only from the liveDataTranslateMarkup() function.

Arguments

source

  • The source argument is a string that contains source code, which is parsed and rendered in the error dialog box.

Returns

Nothing.

dreamweaver.setLiveDataMode()

Availability

Dreamweaver UltraDev 1.

Description

Toggles the visibility of the Live Data window.

Arguments

bIsVisible

  • The bIsVisible argument is a Boolean value that indicates whether the Live Data window should be visible. If you pass true to this function and Dreamweaver currently displays the Live Data window, the effect is the same as if you clicked the Refresh button.

Returns

Nothing.

dreamweaver.setLiveDataParameters()

Availability

Dreamweaver MX.

Description

Sets the URL parameters that you reference in your document for use in Live Data mode.

Live Data mode lets you view a web page in the design stage (as if it has been translated by the application server and returned). Generating dynamic content to display in Design view lets you view your page layout with live data and adjust it, if necessary.

Before you view live data, you must enter Live Data settings for any URL parameters that you reference in your document. This prevents the web server from returning errors for parameters that are otherwise undefined in the simulation.

You enter the URL parameters in name-value pairs. For example, if you reference the URL variables ID and Name in server scripts in your document, you must set these URL parameters before you view live data.

This function lets you set Live Data values through JavaScript.

Arguments

liveDataString

  • The liveDataString argument is a string that contains the URL parameters that you want to set, in name-value pairs.

Returns

Nothing.

Example

 dreamweaver.setLiveDataParameters(“ID=22&Name=Samuel”)

dreamweaver.showLiveDataDialog()

Availability

Dreamweaver UltraDev 1.

Description

Displays the Live Data Settings dialog box.

Arguments

None.

Returns

Nothing.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy