user/create error messages managed
This commit is contained in:
parent
6075f4f356
commit
3b8bead445
|
@ -310,7 +310,16 @@ if( section.create.element != null ){
|
||||||
mail: document.querySelector(section.create.text + '#create_mail'),
|
mail: document.querySelector(section.create.text + '#create_mail'),
|
||||||
|
|
||||||
submit: document.querySelector(section.create.text + '#create_submit')
|
submit: document.querySelector(section.create.text + '#create_submit')
|
||||||
}
|
};
|
||||||
|
|
||||||
|
// On recupere tous les messages d'erreur
|
||||||
|
section.create.errmsg = {
|
||||||
|
code: document.querySelector(section.create.text + '.error-msg.create_code'),
|
||||||
|
username: document.querySelector(section.create.text + '.error-msg.create_username'),
|
||||||
|
firstname: document.querySelector(section.create.text + '.error-msg.create_firstname'),
|
||||||
|
lastname: document.querySelector(section.create.text + '.error-msg.create_lastname'),
|
||||||
|
mail: document.querySelector(section.create.text + '.error-msg.create_mail')
|
||||||
|
};
|
||||||
|
|
||||||
// On initialise le gestionnaire des saisies
|
// On initialise le gestionnaire des saisies
|
||||||
var createChecker = new inputChecker();
|
var createChecker = new inputChecker();
|
||||||
|
@ -331,6 +340,12 @@ if( section.create.element != null ){
|
||||||
// On annule l'envoi de base (PHP)
|
// On annule l'envoi de base (PHP)
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
section.create.errmsg.code.innerHTML =
|
||||||
|
section.create.errmsg.username.innerHTML =
|
||||||
|
section.create.errmsg.firstname.innerHTML =
|
||||||
|
section.create.errmsg.lastname.innerHTML =
|
||||||
|
section.create.errmsg.mail.innerHTML = '';
|
||||||
|
|
||||||
var request = {
|
var request = {
|
||||||
path: 'userDefault/create', // On veut creer un utilisateur
|
path: 'userDefault/create', // On veut creer un utilisateur
|
||||||
code: section.create.input.code.value,
|
code: section.create.input.code.value,
|
||||||
|
@ -353,8 +368,11 @@ if( section.create.element != null ){
|
||||||
section.create.input.lastname.value = '';
|
section.create.input.lastname.value = '';
|
||||||
section.create.input.mail.value = '';
|
section.create.input.mail.value = '';
|
||||||
|
|
||||||
}else // Erreur
|
}else{ // Erreur
|
||||||
console.error('ModuleError::'+answer.error);
|
console.error('ModuleError::'+answer.error);
|
||||||
|
if( /^[^']*'(\w+)'/i.test(answer.ErrorDescription) )
|
||||||
|
section.create.errmsg[RegExp.$1].innerHTML = 'Champ manquant ou erronné.';
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue