Adobe livecycle 表单验证电子邮件、数字等。
Adobe livecycle form validation email, numbers etc.
我不熟悉 Adobe live cycle,但我正在创建一个需要验证的表单。当用户输入电子邮件时,我将此脚本用于验证我的电子邮件,该电子邮件在另一个 PDF 中有效,但 Live Cycle 出于某种原因未读取它。它没有阅读我的任何验证。帮助?
<script>
var str = this.getField("1-3f-email").value;
if (str != "") {
var regExp = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|ca|mx|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)\b$/;
if (!regExp.test(str)) {
app.alert("Please ensure email address is valid");
resetForm(["1-3f-email"]);
}
}
</script>
- Adobe livecycle 有一个电子邮件字段,它内置了电子邮件地址验证。您可以选择使用它吗?
- 如果没有。您可以将脚本放入字段
的验证事件中
var r = new RegExp(); // Create a new Regular Expression Object.
r.compile("^[a-z0-9_\-\.]+\@[a-z0-9_\-\.]+\.[a-z]{2,3}$","i");// Set the regular expression to look for an email address in general form.
var result = r.test(this.rawValue); // Test the rawValue of the current object to see if it fits the general form of an email address.
if (result == true) // If it fits the general form,
true; // all is well.
else // Otherwise,
false; // fail the validation.
我不熟悉 Adobe live cycle,但我正在创建一个需要验证的表单。当用户输入电子邮件时,我将此脚本用于验证我的电子邮件,该电子邮件在另一个 PDF 中有效,但 Live Cycle 出于某种原因未读取它。它没有阅读我的任何验证。帮助?
<script>
var str = this.getField("1-3f-email").value;
if (str != "") {
var regExp = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|ca|mx|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)\b$/;
if (!regExp.test(str)) {
app.alert("Please ensure email address is valid");
resetForm(["1-3f-email"]);
}
}
</script>
- Adobe livecycle 有一个电子邮件字段,它内置了电子邮件地址验证。您可以选择使用它吗?
- 如果没有。您可以将脚本放入字段 的验证事件中
var r = new RegExp(); // Create a new Regular Expression Object.
r.compile("^[a-z0-9_\-\.]+\@[a-z0-9_\-\.]+\.[a-z]{2,3}$","i");// Set the regular expression to look for an email address in general form.
var result = r.test(this.rawValue); // Test the rawValue of the current object to see if it fits the general form of an email address.
if (result == true) // If it fits the general form,
true; // all is well.
else // Otherwise,
false; // fail the validation.