Copy link to clipboard
Copied
Hi Everyone...
First a shout out to Thom Parker for his Change ComboBox form! https://acrobatusers.com/tutorials/change_another_field/
I am using that form to add RadioButtons to change the contents of the ComboBox and echo the event.values to holding textboxes on screen. That is all working.
Any suggestions would be treated appreciated. What am I missing?
My issue is that once the ComboBox is set with a list of items, the value does not match the item in the list on-screen.
I set a textbox with ComboBox.value. So if Accounting is selected, Pick One...RB1 is what is placed in the textbox.value.
ComboBox Format-Keystorke
var vChoice = this.getField("rbgChoice").value;
var cDeptName = ""
if( event.willCommit );
{ if (vChoice == "Choice1") {
this.getField("txEventValue").value =vChoice;
// Place all prepopulation data into a single data structure
this.resetForm(["DeptContact","DeptEmail","DeptNumber"]);
else SetFieldValuesChoice1(); } }
else{
this.getField("txEventValue").value = vChoice ;
// Place all prepopulation data into a single data structure
this.resetForm(["DeptContact","DeptEmail","DeptNumber"]);
else
SetFieldValuesChoice2(); }
}
}
SetFieldValuesChoice[1][2] are the same except of the reference 1 or 2 depending on the RadioButton number.
var vListChoice = "";
if(event.value == " ")
this.resetForm(["DeptContact","DeptEmail","DeptNumber","txListCondition"]);
else SetFieldValues(event.value);
function SetFieldValues() {
vListChoice = this.getField("dbDepartmentNames").currentValueIndices
this.getField("txEventValue").value = "SetFieldValuesChoice1 worked";
this.getField("txListValue").getItemAt(vListChoice,false); //Does not give the same value as what is listed in the ComboBox
//if (vListChoice=="Pick One....RB1") {this.getField("txListValue").value = vListChoice;
//else if ("Accounting") this.getField("txListValue").value = vListChoice ;
//else if ("Engineering") this.getField("txListValue").value = vListChoice;
//else if ("Marketing") this.getField("txListValue").value = vListChoice;
//else if ("ITSupport") this.getField("txListValue").value = vListChoice;
//else this.getField("txListValue").value = "Nothing Happened";
//}
}
Robert, thank you for the compliments.
The general problem with the form scripts is that things are not happening the way you think they are. You're over thinking it. For example, the combobox keystroke script calls functions named "SetFieldValuesChoice1" and "SetFieldValuesChoice2". Neither of these functions exist. Instead there are two document level scripts with these names. This is not the same as defining a function.
Each of these document level scripts contains the same code. So the se
...Copy link to clipboard
Copied
Copy link to clipboard
Copied
Robert, thank you for the compliments.
The general problem with the form scripts is that things are not happening the way you think they are. You're over thinking it. For example, the combobox keystroke script calls functions named "SetFieldValuesChoice1" and "SetFieldValuesChoice2". Neither of these functions exist. Instead there are two document level scripts with these names. This is not the same as defining a function.
Each of these document level scripts contains the same code. So the second is is simply overwriting anything defined in the first. Including the function definition for "SetFieldValue". Please take a look at this function definition. And delete one of these document scripts.
Now, if your intention is to set the "txListValue" field based on the selected item, then you don't need two different functions. In fact, there is no reason for the keystroke script to contain any code that references the radio buttons. That data is already in the combobox.
Change the Keystroke script to this:
if( event.willCommit )
{
this.getField("txListValue").value = event.value;
}
That is all you need.