Warning Shown When Saving Component With Javascript Object Placeholders

Description

An informational warning/alert that notifies the user when saving a UX or Grid component with certain object placeholders.

Display warning during saving

When you save a UX or Grid component, if your Javascript function definitions contain object placeholders (e.g. {dialog.object} in the case of a UX or {grid.object} in the case of a Grid), a warning message is displayed alerting you to the possibility of a problem. In many cases you can safely ignore this warning and you might want to check the box to suppress the warning in the future. You can suppress the warning for all components or just the component you are editing.

Warning shown when saving a UX or Grid component that uses object placeholders in JavaScript function definitions

Jswarning

Purpose of this Feature:

This is a preventative measure designed to help developers avoid common and sometimes hard-to-diagnose runtime errors.

The "Problem":

The placeholders {dialog.object} and {grid.object} are not standard Javascript. They are special strings that Alpha Anywhere replaces with a reference to the actual Javascript component object at runtime, when the component is running in a browser.

The Risk:

If a developer writes Javascript that tries to use this object before the component has been fully rendered and initialized, the code will fail. The static code in the editor looks correct, but the timing of its execution at runtime is wrong. This warning serves as a reminder to the developer to ensure their code is placed in an appropriate event handler (like onRenderComplete or a button's onClick event) where the object is guaranteed to exist.

The Solution:

For more information, see [Suppress warnings if Javascript functions contain placeholders]

The following video explains the types of problems that can occur when object placeholders are used in JavaScript function definitions:

See Also