I am not familiar with Adobe live cycle but I am creating a form which I need some validation. When a user inputs a email I put this script to validate my email which works in another PDF but Live Cycle is not reading it for some reason. It is not reading any of my validations. Help?
<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>
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.