I can populate a text box with a value from a dropdown, however if I have 2 dropdown values going to the same text box (multi-line), the second dropdown value removes the first value.
(Similar code on Dropdown 1 and Dropdown 2)
Change Event - JavaScript
if(xfa.event.newText == 'No'){
form1.page1.subform2.description.rawValue="No location listed";
}
if(xfa.event.newText == "Partial location"){
form1.page1.subform2.description.rawValue="Partial location listed";
}
Do I have to Concat the fields in the 1 text field to get it to list multiple dropdown values, and if so how do I do that?
Thanks in advance for your help.
Solved! Go to Solution.
Views
Replies
Total Likes
Solved:
Place this script in the subform root level in the FormReady event -JavaScript.
var oList = this.getDeltas ();
for (i=0; i < oList.length; i ++)
{
var oDelta = oList.item(i);
oDelta.restore ();
}
Answer was found at http://forms.stefcameron.com/2008/09/29/restoring-the-of-your-form/
Views
Replies
Total Likes
Is this what you are after?
// form1.page1.subform1.tf::calculate - (JavaScript, client)
if (form1.page1.subform1.color.selectedIndex != -1 && form1.page1.subform1.fruit.selectedIndex != -1) {
this.rawValue = form1.page1.subform1.color.rawValue + "\n" + form1.page1.subform1.fruit.rawValue;
}
else {
if (form1.page1.subform1.color.selectedIndex != -1 && form1.page1.subform1.fruit.selectedIndex == -1) {
this.rawValue = form1.page1.subform1.color.rawValue;
}
else {
if (form1.page1.subform1.color.selectedIndex == -1 && form1.page1.subform1.fruit.selectedIndex != -1) {
this.rawValue = form1.page1.subform1.fruit.rawValue;
}
}
}
Steve
Thanks Steve for your help on this, you are amazing!
That is close. I am actually trying to display specific values from the dropdown.
So for your example, lets say I want just Red and Green values from the color field and Apples and Pears from the Fruit field to populate the textbox. I also want to change the drop down value of "Red" to say "Ruby Red" to in the Text box. Is that possible?
Views
Replies
Total Likes
YAY - I got it figured out!
On Color Drop Down - Change Event, JavaScript
if (xfa.event.newText == 'Red') {
form1.page1.subform1.textbox.rawValue="Ruby Red";
}
if (xfa.event.newText == 'Green'){
form1.page1.subform1.textbox.rawValue="Light Green";
}
On Fruit Drop Down - Change Event, JavaScript
if (xfa.event.newText == 'Apple') {
form1.page1.subform1.textbox.rawValue="Granny Smith";
}
if (xfa.event.newText == 'Pear'){
form1.page1.subform1.textbox.rawValue="Bartlett";
}
On Text Box - Calculate Event, JavaScript
this.rawValue = form1.page1.subform1.color.rawValue + "\n" + form1.page1.subform1.fruit.rawValue;
Thank you Steve for pointing me into the right direction.
Views
Replies
Total Likes
It works for only a few drop down values, if I get more than 6 going it displays only the last drop-down value. What am I doing wrong?
Views
Replies
Total Likes
If you send the form to stwalker.adobe@gmail.com I'd be happy to take a look.
Steve
Views
Replies
Total Likes
Changed the event from Change to Calculated and then the value type "Calculated - Read only" to "Calculated - User can override" and it didn't work. Text box is blank.
Views
Replies
Total Likes
HUMMMMM – How would I add the dropdown fields to the text box?
Eve Tracy
Views
Replies
Total Likes
You need to remove the script from each drop-down change event and put all the script on the description calculate event. For example,
// form1.NonCompliancePage.subform2.description::calculate - (JavaScript, client)
var str = "";
if (form1.recordKeepingPage.RecordKeeping.rk_BusName.rawValue == "Required Records - No business name listed" || form1.recordKeepingPage.RecordKeeping.rk_BusName.rawValue == "Required Records - Partial business name listed") {
if (form1.recordKeepingPage.RecordKeeping.rk_BusName.rawValue == "Required Records - No business name listed") {
str = "Required Records-No business name listed" + "\n";
}
else {
str = "Required Records - Partial business name listed" + "\n";
}
}
if (form1.recordKeepingPage.RecordKeeping.rk_StAddress.rawValue == "No" || form1.recordKeepingPage.RecordKeeping.rk_StAddress.rawValue == "Partial address" || form1.recordKeepingPage.RecordKeeping.rk_StAddress.rawValue == "P.O Box only") {
if (form1.recordKeepingPage.RecordKeeping.rk_StAddress.rawValue == "No") {
str = str + "Required Records-No address of the application listed" + "\n";
}
else {
if (form1.recordKeepingPage.RecordKeeping.rk_StAddress.rawValue == "Partial address") {
str = str + "Required Records-Partial address listed" + "\n";
}
else {
str = str + "Required Records-PO Box only listed" + "\n";
}
}
}
this.rawValue = str;
Steve
Views
Replies
Total Likes
Thank you so much! This is exactly what I was wanting to do, you are Amazing!
Views
Replies
Total Likes
I have another question regarding the script to populate a text box with multiple dropdown values.
How do you save the form state (keep the page visible after it has been saved)? This form will be connected to a signature pad, so it has to be certified and preserve scripting changes to form when saved is set to manually.
I can save the form state of several other hidden pages using this code in the initialize event:
if
(this.rawValue==1)
{subformName.presence="visible";}
else
{subformName.presence="hidden";}
However, since I have multiple fields writing to a text box using the calculated event, I can't seem to save the form state using the code above.
Please help, I have been searching forums and can not find a solution to this one.
Views
Replies
Total Likes
Solved:
Place this script in the subform root level in the FormReady event -JavaScript.
var oList = this.getDeltas ();
for (i=0; i < oList.length; i ++)
{
var oDelta = oList.item(i);
oDelta.restore ();
}
Answer was found at http://forms.stefcameron.com/2008/09/29/restoring-the-of-your-form/
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies