簡體   English   中英

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有一個電子郵件字段,該字段內置了電子郵件地址驗證。 您可以選擇使用它嗎?
  • 如果不。 您可以將腳本放入字段的validate事件中

 var r = new RegExp(); // Create a new Regular Expression Object. r.compile("^[a-z0-9_\\-\\.]+\\@[a-z0-9_\\-\\.]+\\.[az]{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. 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM