hub.eb?material_id=92

Messages - add warning and error message


Instead of displaying messages using controls with fixed text, you can add warning and error messages with code that will disappear automatically when you next click a button.

You can add an error message to a particular control using the following code:

controls.password_field_control.addErrorMessage("You must enter a password");

You can add message controls to your page to specify a particular position where you want messages to appear. However, you can add messages to most types of controls as well.

The addErrorMessage() function stops the script that point, and no other scripts that were due to follow it will be run.

Warning messages are very similar to error messages, but do not end the script execution.

Both functions take an optional second parameter that allow you to specify whether the script execution is to stop or not.

Related