Checking event
This event is triggered just before you start verifying a phone. It allows you to display text or an animated image when the user is waiting.
Example:
dqephone.on("checking", function() {
$('#my_phone_state').html("Loading...");
});
Checked event
This event is triggered when the phone number has been analyzed. It allows you to display the result of the analysis and even to format the field accordingly. It is mandatory to implement this event if the "autocheck " parameter is set to "true" as it is the only way to know the result of the validation.
Example:
dqephone.on('checked', function(ui, data) {
var msg = data.status ? "Valid phone" : "Incorrect phone";
$('#id_phone_status').html(msg);
});
The "checked" event returns a "data" dictionary that contains the following keys:
- Return codes:
- 2: the line is built but the phone may be inactive.
- 1: valid phone number.
- 0: incorrect phone number.
- input: tested phone number.
- output: reformatted phone number according to the "Format" setting.
Special cases related to the use of Bootstrap
If you use the Bootstrap Framework to code your HTML pages, know that the DQE Phone Match library comes with all the code needed to display icons and change the color of the field in accordance with the 3 available validation styles:
- success
- warning
- error