Hi everyone
I've been trying to follow the instructions here: http://acrobatusers.com/tutorials/print/change_another_field
so I tried to adapt the explained method to my form but nothing is happening really:
here is my form : http://cjoint.com/?BKgsODn3tsD
basically if in the field "Module code" I select Y1H3, I display in the fileds "Texte nRow.. " only:
3 <= Texte nRow1
13 <= Texte nRow2
20 <= Texte nRow3
if Y2H5 is selected I will have the following sequence displayed:
1 <= Texte nRow1
7 <= Texte nRow2
12 <= Texte nRow3
21 <= Texte nRow4
22 <= Texte nRow5
and so one for Y3H6 selected ... up to H6H11
this is what I've try to do:
so for the field "Module code": in proprities > Validate > Run custom validation script I wrote:
if( event.willCommit )
{ if(event.value == " ") this.resetForm(["Texte nRow1","Texte nRow2","Texte nRow3","Texte nRow4","Texte nRow5","Texte nRow6","Texte nRow7","Texte nRow8","Texte nRow9","Texte nRow10","Texte nRow11"]); else SetFieldValues(event.value);
}
then I created a document Javascript called SetFieldValues with the following code:
//-------------------------------------------------------------
//-----------------Do not edit the XML tags--------------------
//-------------------------------------------------------------
//<Document-Level>
//<ACRO_source>SetFieldValues</ACRO_source>
//<ACRO_script>
/*********** belongs to: Document-Level:SetFieldValues ***********/
// Place all prepopulation data into a single data structure
var DeptData = { Y1H3:{ Line1: "3", Line2: "13", Line3: "20", Line4: "", Line5: "", Line6: "", Line7: "", Line8: "", Line9: "", Line10: "", Line11: "" }, Y2H5:{ Line1: "1", Line2: "7", Line3: "12", Line4: "21", Line5: "22", Line6: "", Line7: "", Line8: "", Line9: "", Line10: "", Line11: "" }, Y3H6 :{ Line1: "5", Line2: "11", Line3: "16", Line4: "23", Line5: "34", Line6: "39", Line7: "", Line8: "", Line9: "", Line10: "", Line11: "" }, Y4H8:{ Line1: "2", Line2: "6", Line3: "9", Line4: "15", Line5: "30", Line6: "33", Line7: "38", Line8: "42", Line9: "", Line10: "", Line11: "" }, Y5H9:{ Line1: "4", Line2: "10", Line3: "26", Line4: "29", Line5: "31", Line6: "35", Line7: "37", Line8: "40", Line9: "41", Line10: "", Line11: "" }, Y5H9:{ Line1: "8", Line2: "14", Line3: "17", Line4: "18", Line5: "19", Line6: "24", Line7: "27", Line8: "28", Line9: "32", Line10: "", Line11: "" }};
function SetFieldValues(cDeptName)
{ this.getField("Texte nRow1").value = DeptData[cDeptName].Line1; this.getField("Texte nRow2").value = DeptData[cDeptName].Line2; this.getField("Texte nRow3").value = DeptData[cDeptName].Line3; this.getField("Texte nRow4").value = DeptData[cDeptName].Line4; this.getField("Texte nRow5").value = DeptData[cDeptName].Line5; this.getField("Texte nRow6").value = DeptData[cDeptName].Line6; this.getField("Texte nRow7").value = DeptData[cDeptName].Line7; this.getField("Texte nRow8").value = DeptData[cDeptName].Line8; this.getField("Texte nRow9").value = DeptData[cDeptName].Line9; this.getField("Texte nRow10").value = DeptData[cDeptName].Line10; this.getField("Texte nRow11").value = DeptData[cDeptName].Line11;
}
//</ACRO_script>
//</Document-Level>
//<AcroForm>
//<ACRO_source>DepartmentNames:Keystroke</ACRO_source>
//<ACRO_script>
/*********** belongs to: AcroForm:DepartmentNames:Keystroke ***********/
and actually nothing happened,
can anyone have a look at it please?
thanks a lot,