[英]Display all validation errors in alertbox
Is it possible to list all validation errors in alertbox. 是否可以在警报框中列出所有验证错误。 Currently its showing only the first instance of the error.
当前,它仅显示错误的第一个实例。
function form_validation_alert(type, name, num){
name = name.replace(/^\W*(\w*)\W*$/, "$1");
msg = form_validation_alerts[type];
msg = msg.replace('%%Name%%', name.substr(0, 1).toUpperCase()+name.substr(1, name.length-1).toLowerCase());
msg = msg.replace('%%name%%', name.toLowerCase());
msg = msg.replace('%%num%%', num);
alert(msg);
return false;
}
JavaScript code: http://catch24.catch24dev.com/forms/form-validation.js JavaScript代码: http : //catch24.catch24dev.com/forms/form-validation.js
You can check the form at: http://catch24.catch24dev.com/forms 您可以在以下位置检查表单: http : //catch24.catch24dev.com/forms
Thanks! 谢谢!
try to concatenate all messages. 尝试串联所有消息。
function form_validation_alert(type, name, num){
name = name.replace(/^\W*(\w*)\W*$/, "$1");
msg = form_validation_alerts[type];
msg = msg + msg.replace('%%Name%%', name.substr(0, 1).toUpperCase()+name.substr(1, name.length-1).toLowerCase());
msg = msg + msg.replace('%%name%%', name.toLowerCase());
msg = msg + msg.replace('%%num%%', num);
alert(msg);
return false;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.