常用JavaScript集錦

//獲取簽名信息
 var oState =event.target.getField("form1[0].#subform[0].SignatureField1[0]").signatureValidate();
 //Get the field's signed state.
 if (oState == 0) {...}
//提交時能否從瀏覽器打開網頁
app.launchURL("http://www.adobe.com",true);
//調用別人的事件
abc.sf2.sf11.lend.execEvent("exit");
一些屬性
Scripting > Scripting Reference > Scripting Properties
//執行菜單裏面的功能
app.execMenuItem("SaveAs");
//添加另外一個判斷button隱藏功能button
var vSignature=event.target.getField("abc[0].ss8[0].companysignature[0]").signatureInfo(); 
  
  if(vSignature.numRevisions==1){  
   xfa.host.messageBox("發送回執");
   
  }else{
   xfa.host.messageBox("請在“開戶單位數字簽名”處正確簽名後再提交!簽名失效請重新簽名!");
  }
//獲取附件並保存
var d = event.target.dataObjects;
if (d != null)
      for (var i = 0; i < d.length; i++)
      {
            event.target.exportDataObject(d[i].name);
       }
      
//去除簽名 
var signatureField=event.target.getField("abc[0].ss8[0].companysignature[0]");
 xfa.signature.clear(signatureField, 0);------待驗證沒實現
//驗證簽名是否正確
Reference_Syntax.verify( OBJECT param1 [, BOOLEAN param2 [, OBJECT param3 [, OBJECT param4 ] ] ] )
0 Signature is blank.
1 Unknown status. In this case, no attempt to validate the signature was made. One possible cause is a software or hardware issue that is preventing the validation from occurring.
2 Signature is invalid.
3 Signature is valid, but the identity of the signer could not be verified.
4 Signature is valid and the identity of the signer is valid.

//使用button發送郵件
event.target.submitForm({cURL: "mailto:[email protected]”,

                                        bEmpty: true,      // Post all fields (true), or do Not post all fields (false)

                                        cSubmitAs: "XDP",  // Post XDP format

                                        cCharset: "utf-8"});

event.target.submitForm(cURL:"mailto:[email protected]",
          bEmpty:true,
          cSubmitAs:"PDF",
          cCharset:"utf-8"
          );

//設置權限
  abc.sf2.sf11.borrow.access="protected";
   abc.sf2.sf11.lend.access="protected";
  
abc.sf2.sf11.borrow.access="readOnly";
abc.sf2.sf11.lend.access="readOnly";

發佈了23 篇原創文章 · 獲贊 1 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章