Populate Text Field Based On Drop-Down List Selection | Community
Skip to main content
June 12, 2006

Populate Text Field Based On Drop-Down List Selection

  • June 12, 2006
  • 22 replies
  • 81492 views
I'm trying to set up a form so that a text field will populate with default text (that could later be edited by the end user) based on a users previous drop-down selection.



For example:



The end user is putting together a proposal for a client and is able to choose the type of proposal or service from a drop-down list. Once the user makes a selection from the drop-down list a text field is populated with default text describing the service.



The only catch is that the end user would need to be able to edit the default text. An example would be if an individual purchased a car but all the specific features and/or accessories could be added into the default text as necessary based on the purchasers desired upgrades. The common or universal features of the car would, however, show up as the default text.



Would this scenario be possible through the use of XML? Any tips on how I can accomplish this would be much appreciated.
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

22 replies

New Participant
October 31, 2011

I am Working on a text field to, creating the form is no problem with a little Script.Right now Im just using an easy Drop Down Menu Generator.

http://www.javascriptsandmore.com/drop-down-menu-generator-software.html

February 13, 2009
Stefan,



I used your example in my table, which worked for the first row. However, I have a repeatable table with add and delete row buttons and the drop down only populates the first row.



So, if I use the first drop down on the first row, it populates the first text field in the first row just fine. However, when I use the drop down on the next row, the first row gets updated instead of the second row text field. How do I tweak the nomenclature so that it knows to correspond to the same row?



Dave
February 6, 2009
Hi how to generate the text field with the selection of an item in the combo box please help me if any one knows
New Participant
November 3, 2008
If you are going to set another field's value from a combo box or list you need to use some form a scripting.
November 3, 2008
I am trying to populate text fields with the same information, such as the name, address, and phone number. I want to know if there is way that I can do so, without having to use any outside coding. I don't need to populate complex information, just the basic. I guess my main purpose is to have that simple information populate throughout a form without having re-type such information throughout my 4-6page forms. Leaving me with less room for error.
September 18, 2008
I am not sure this is what you are looking for but this is the script behind the drop down on change event and InsertNote1 is the text field being populated. The text field is also set to Calculated - Allow User Override.



var sNewSel = this.boundItem(xfa.event.newText);

var bEnableTextField = true;



switch (sNewSel)

{

case "1": // Option 1

InsertNote1.rawValue = "Text if option 1 is selected.";

break;



case "2": // Option 2

InsertNote1.rawValue = "Text if option 2 is selected."

break;



case "3": // Option 3

InsertNote1.rawValue = "Text if option 3 is selected."

break;



case "4": // Option 4

InsertNote1.rawValue = "Text if option 4 is selected."

break;



case "5": // Option 5

InsertNote1.rawValue = "Text if option 5 is selected."

break;



case "6": // Option 6

InsertNote1.rawValue = "Text if option 6 is selected."

break;



case "7": // Option 7

InsertNote1.rawValue = "Text if option 7 is selected."

break;



case "8": // Option 8

InsertNote1.rawValue = "Text if option 8 is selected."

break;



default: // unknown value -- do nothing

bEnableTextField = false;

break;

}



if (bEnableTextField)

{

InsertNote1.access = "open"; // enable field

InsertNote1.caption.font.fill.color.value = "0,0,0"; // set caption to black

}
September 18, 2008

September 16, 2008
Greetings,



I've figured out how to string together different text and numeric fields into a single text field. My question is - is there any way i can have the results sent as a text message to a mobile phone? I simply want to send simple text to a mobile phone number.



Any ideas?
September 5, 2008
I'm also trying to have it populate multiple text fields across multiple pages.
September 4, 2008
I'm using Stefan's original example which is exactly what I am looking for but I'm having trouble moving the text field to a different page than the drop down. I want the user to select from the dropdown on page 1 and have that populate text fields on other pages. Is there additional script involved?