Skip to content

anonymous /gist:1103051

3.8.1 Customizing the validation messages
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script>
function addCustomValidation() {
var fldName = document.getElementById('fullname');
fldName.form.onsubmit = function () {
fldName.setCustomValidity("");
if (!fldName.validity.valid) {
fldName.setCustomValidity("Nameless ones are not allowedto take part");
}
};
}
</script>
</head>
<body onload="javascript:addCustomValidation();">
<form>
<label>Full name: <input id="fullname" /></label> <br/>
<input type="submit" value="Enviar">
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.