"suggest" Events
This event is triggered as soon as an item in the suggested list is selected. The event is triggered by only providing the selected firstname as parameter.
"change" Events
This event (without parameters) is triggered as soon as the first name or title is changed (manually or via the autocomplete). It is useful for hiding the warning message previously displayed following a "genderError" or a "validateError".
"validateError" Events
This event is triggered when exiting the first name field when an unknown first name has been entered.
"genderError" Events
If the "civility" field and the list of genders of civilities are provided, the DQE Name plugin triggers a "genderError" event when the gender (male or female) of the first name does not match the gender of the civility. The event is triggered by providing two parameters:
- civilityGender (« M » or « F ») ;
- firstnameGender (« M » or « F »).
Example:
var dqefirstname = $('#id_first_name').dqefirstname(options);
dqefirstname.on("genderError", function(error, civility_gender, name_gender) {
var genders = {M: 'masculine', F: 'feminine'};
var gender1 = genders[civility_gender];
var gender2 = genders[name_gender];
var msg = "You entered a first name" + gender2 + "whereas civility corresponds to a first name" + gender1;
$('#id_status').html(msg);
}).on("validateError", function() {
$('#id_status').html('The first name entered is unknown');
}).on("change", function() {
$('#id_status').html('');
});