How to use a botton event import some string from txt to text field
dears,
I have add a botton in acrobat,it‘s javascript code as follow.
this.importDataObject("myData.txt");
var oFile = this.getDataObjectContents("myData.txt");
var cFile = util.stringFromStream(oFile,"GBK");
aFile = cFile.split(";");
this.getField("text0").value = aFile[0];
if (aFile[1] == "1"){
this.getField("text4").value = "Yes";
this.getField("text1").value = aFile[2];
this.getField("text3").value = aFile[3];
this.getField("text4").value = aFile[4];
}
if (aFile[1] == "0"){
this.getField("text5").value = "Yes";
this.getField("text2").value = aFile[2];
this.getField("text5").value = aFile[3];
this.getField("text6").value = aFile[4];
}
Open this with acrobat editer,it works. This fuction will open a dailog,then we can select the txt file,and then the text field will fill up.
but when i open this with acrobat reader,it cann't works. I don't kown how adjust my code,then it can be work in acrobat reader.
please help me,I would appreciate it very much.thanks.
