The server formats API consists of the following data formatting functions.

applyFormat()

Availability

Dreamweaver UltraDev 1.

Description

This function can edit a user’s document by adding a format function declaration to it. When a user selects a format from the Format text field in the Dynamic Data or the Dynamic Text dialog box or in the Bindings panel, Dreamweaver makes two changes to the user’s document: It adds the appropriate format function before the HTML tag (if it’s not already there), and it changes the dynamic data object to call the appropriate format function.

Dreamweaver adds the function declaration by calling the applyFormat() JavaScript function in the data format file. It changes the dynamic data object by calling the formatDynamicDataRef() function.

The applyFormat() function should use the DOM to add function declarations to the top of the user’s document. For example, if the user selects Currency ‑ Default, the function adds the Currency function declaration.

Arguments

format

  • The format argument is a JavaScript object that describes the format to apply. The JavaScript object is the node that corresponds to the format tag in the Formats.xml file. The object has a JavaScript property for each attribute of the corresponding format tag.

Returns

Dreamweaver expects nothing.

applyFormatDefinition()

Availability

Dreamweaver UltraDev 1.

Description

Commits the changes to a format that was created using the Edit Format dialog box.

Users can create, edit, or delete formats with the Edit Format List dialog box. This function is called to commit any modifications that are made to a format. It can also set other, arbitrarily named properties on the object. Each property is stored as an attribute of the format tag in the Formats.xml file.

Arguments

format

  • The format argument corresponds to the JavaScript format object. The function must set the expression property of the JavaScript object to be the regular expression for the format. The function can also set other, arbitrarily named properties of the object. Each property is stored as an attribute of the format tag.

Returns

Dreamweaver expects the format object, if the function completes successfully. If an error occurs, the function returns an error string. If it returns an empty string, the form is closed, but the new format is not created, which is the same as a Cancel operation.

deleteFormat()

Availability

Dreamweaver UltraDev 1.

Description

Removes the format function declaration from the top of the user’s document.

When the user changes the format of a dynamic data object (in the Dynamic Data or the Dynamic Text dialog box or in the Bindings panel) or deletes a formatted dynamic data object, Dreamweaver removes the function declaration from the top of the document and also removes the function call from the dynamic data object by calling the deleteFormat() function.

Use the DOM with the deleteFormat() function to remove the function declaration from the top of the current document.

Arguments

format

The format argument is a JavaScript object that describes the format to remove. The JavaScript object is the node that corresponds to the format tag in the Formats.xml file.

Returns

Dreamweaver expects nothing.

formatDynamicDataRef()

Availability

Dreamweaver UltraDev 1.

Description

Adds the format function call to the dynamic data object. When a user selects a format from the Format text box in the Dynamic Data or the Dynamic Text dialog box or in the Bindings panel, Dreamweaver makes two changes to the user’s document: It adds the appropriate format function before the HTML tag (if it’s not already there), and it changes the dynamic data object to call the appropriate format function.

Dreamweaver adds the function declaration by calling the applyFormat() JavaScript function in the data format file. It changes the dynamic data object by calling the formatDynamicDataRef() function.

The formatDynamicDataRef() function is called when the user selects a format from the Format text box in the Dynamic Data or the Dynamic Text dialog box or in the Bindings panel. It does not edit the user’s document.

Arguments

dynamicDataObject, format

  • The dynamicDataObject argument is a string that contains the dynamic data object.

  • The format argument is a JavaScript object that describes the format to apply. The JavaScript object is the node that corresponds to the format tag in the Formats.xml file. The object has a JavaScript property for each attribute of the corresponding format tag.

Returns

Dreamweaver expects the new value for the dynamic data object.

If an error occurs, the function displays an alert message under certain conditions. If the function returns an empty string, the Format text box is set to None.

inspectFormatDefinition()

Availability

Dreamweaver UltraDev 1.

Description

Initializes form controls when a user edits a format in the Edit Format List dialog box.

Arguments

format

The format argument is a JavaScript object that describes the format to apply. The JavaScript object is the node that corresponds to the format tag in the Formats.xml file. The object has a JavaScript property for each attribute of the corresponding format tag.

Returns

Dreamweaver expects 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