2015-01-22 5 views
1

Adobe 라이브 사이클에 익숙하지 않지만 유효성 검사가 필요한 양식을 만들고 있습니다. 사용자가 이메일을 입력 할 때 다른 PDF에서 작동하는 이메일을 검증하기 위해이 스크립트를 넣었지만 어떤 이유로 Live Cycle이 그것을 읽지 않습니다. 그것은 나의 유효성 검사를 읽지 않습니다. 도움?Adobe Livecycle 양식 유효성 검사 전자 메일, 숫자 등

<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> 

답변

1
  • 어도비 라이브 사이클 이메일 주소 확인에 내장 한 전자 메일 필드가 있습니다. 당신이 그것을 사용할 수있는 옵션이 될 수 있을까요?
  • 아니요. 당신은 필드

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.

의 Validate 이벤트에 스크립트를 넣을 수 있습니다