Ich habe ein Änderungsereignis in einem E-Mail-Feld, das validieren soll, dass die E-Mail-Adresse mit einem Ajax-Aufruf eindeutig ist. Das Problem ist, dass es mir sagt, dass das Element die Methode setCustomValidity nicht unterstützt. Bitte Hilfe.element.setCustomValidity scheint nicht zu funktionieren
$("#tbEmail").change(function (event) {
var obj = new Object();
obj.email = $("#tbEmail").val();
var params = JSON.stringify(obj);
$.ajax
(
{
type: "POST",
url: "./controllers/Consumer.aspx/validateEmail",
data: params,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
if (result.d != 0) {
var element = $("#tbEmail");
element.setCustomValidity('The email address entered is already registerd.');
alert(element.checkValidity());
alert(element.validationMessage);
}
else {
$("#tbEmail").setCustomValidity("");
};
},
error: function (result) { ProcessError(result) }
}
);
})
Das hat geklappt! Vielen Dank Vinayakj. Damit hätte ich tagelang gespielt und nicht daran gedacht. Wie akzeptiere ich eine Antwort? Ich bin neu in stackoverflow. – pachyderm94