Any weblet property where JavaScript is a valid or expected value will accept an inline JavaScript enclosed in single quotes. The format of the JavaScript is your responsibility.
All inline JavaScript must end with a semicolon ( ; ) For example, 'alert("hello world");'. Note that, because the JavaScript must be enclosed in single quotes (this is done for you in the background), you cannot use a single quote within the code. If you need to do this, consider creating a function in an external JavaScript file and calling it from your inline code.
Most properties that expect JavaScript are executed in response to an event or just prior to performing some action. For example, the presubmit_js property of the std_button weblet is executed just before the form is submitted to the server. This gives you the opportunity to provide some extra processing or to cancel the event/action. To cancel the event/action you must use "return false;"
For example:
if ( confirmWithUser() == false) return false;
(where confirmWithUser is a function you have defined in an external JavaScript file)
|