A dialog button that can be controlled with javascript
Methods
-
bind(callback) -
Registers a function to be called when the button is clicked.
Parameters:
Name Type Description callbackfunction function to be triggered on click or programatically.
Example
AP.require('dialog', function(dialog){ dialog.getButton('submit').bind(function(){ alert('clicked!'); }); }); -
disable() -
Sets the button state to disabled
Example
AP.require('dialog', function(dialog){ dialog.getButton('submit').disable(); }); -
enable() -
Sets the button state to enabled
Example
AP.require('dialog', function(dialog){ dialog.getButton('submit').enable(); }); -
isEnabled(callback) -
Query a button for it's current state.
Parameters:
Name Type Description callbackfunction function to receive the button state.
Example
AP.require('dialog', function(dialog){ dialog.getButton('submit').isEnabled(function(enabled){ if(enabled){ //button is enabled } }); }); -
toggle() -
Toggle the button state between enabled and disabled.
Example
AP.require('dialog', function(dialog){ dialog.getButton('submit').toggle(); }); -
trigger() -
Trigger a callback bound to a button.
Example
AP.require('dialog', function(dialog){ dialog.getButton('submit').bind(function(){ alert('clicked!'); }); dialog.getButton('submit').trigger(); });