Dialogs

The most frequent dialogs are alert, confirm and prompt. In the case of an alert you just need to display a message to the user and require no feedback besides user acknowledgement. Confirm dialog has similar purpose, but expects from the user a response by accepting or declining the message. Prompt waits for user input. The w2ui library includes these dialogs for your convenience.

w2alert(msg, [title], [callBack])

The alert dialog can be called in the following way: First argument, msg, is a message to display. Second optional argument, title, is the title for the dialog. The third optional argument, callBack, is a call back function when dialog is closed.

w2confirm (msg, [title], [callBack])

The confirm dialog can be called in the following way: The method takes up to three arguments w2confirm(msg, [title], [callBack]), where msg is the message to display. You can optionally supply title for the message and a call back function.

w2confirm(options)

You can optionally call w2confirm passing an object with options. This options object has following structure: For convenience, w2confirm will return to you an object with yes() and no() methods that you can use in the following way:

w2prompt(label, [title], [callBack])

Prompts user to enter value. Instead of passing label, title, and callBack, you can call w2prompt in the following way:

w2prompt(options)

Following properties are supported:

User Comments

comments powered by Disqus