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

August 30, 2008
Dear Stefan



Ref. you post above, I am trying to do a similar thing but no vain. Would you please help me?



I have a form where I have drop down list menu named as "Country" it shows names of many countries then I have another drop down list box with the name "cities" which has name of many cities....



In both of the above fields I have manually entered the names of the countries and cities respectively in the designer.



what I want is that when i select the specific country then all cities related to the country only show up in the "cities" drop down list box?



Is this possible in forms? I am using Life Cylce ES 8.2



please advise

Asim
August 28, 2008
Hi Redcoat,



Were you able to figure out how to make the second list a drop down menu?



Thanks, Justin
August 28, 2008
Hi Stefan,



I'm using you code that you posted first. How do I amend it so that the second text box is actually another drop down list?



Thanks, Justin
August 25, 2008
great stuff here.



Can this be applied to work on a second DROP DOWN LIST instead of a text field.



Simply put, I would like to populate a second drop down list based on chosen selections from a first drop down list.



thanks
October 17, 2007
Help.



Could you look at the following and see what I am missing? I have copied Stefan's example. I have modified it within the sample pdf that he posted and it works great. I have now tried to move it to my development form and I cannot get the textfield to populate with the drop down selection. I think it may be in naming convention, but not sure where or how to track down my problem. I have put them on the same subform, but that did not work.



Thanks,



Stan



----- form1.form2.BIP_Subform.EquipList::change: - (JavaScript



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

var bEnableTextField = true;



switch (sNewSel)

{

case "1": // AN

TextField10.rawValue = "Face Shield\nGoggles\nChemical Gloves\nAir Supplied Respirator\nChemical Green Suit\nChemical Boots";

break;



case "2": // BUO

TextField10.rawValue = "Face Shield\nGoggles\nChemical Gloves\nAir Supplied Respirator\nChemical Green Suit\nChemical Boots";

break;



//I have 32 cases, but left them out here)



default: // unknown value -- do nothing

bEnableTextField = false;

break;

}



if (bEnableTextField)

{

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

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

}



My textfield info is:



----- form1.form2.BIP_Subform.TextField10::change: - (JavaScript, client) --------------------------
October 13, 2007
Is there any way that someone could explain it to a beginner?



Dropdown list > address info is based on list selection (address info is multiple lines "address, city, st, zip, phone"



So user is filling out a form, selects recipient, and the address info + phone populates on it's on (into a text box) based on the item selected in the drop down.
September 4, 2007
Stefan -



I had itially looked for a way to simply wrap text in a drop down list as I thought that would be the simplest way to do what the client requested (have a list of standard options to choose from but still enable custom entries).



Since I couldn't find a way to wrap my dropdown text, I tried to modify your sample from but I can't get it to work for me, and I'm not sure if it's the best option for what the client needs.



In addition to not being able to make the drop down affect the text box, how would I get the drop down to hide after exit? I will want to have this pairing repeat (for a total of 6 or 8 text boxes) and want to only print/see the text boxes, and not the drop downs after the text is entered.



My test doc is at www.scottsdaleaz.gov/Assets/documents/airport/TESTING-StipDropDownSelection.pdf



' Here's how I modified what you gave:



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

var bEnableTextField = true;



switch (sNewSel)

{

case "1": // Changes Require Approval Prior to Development Review

Stipulation1.rawValue = "Changes to the development plans anytime after airport staff has signed this

form requires additional airport approval of the change prior to development review

board hearing.";

break;



case "2": // FAA form 7460-1

Stipulation1.rawValue = "Developer must demonstrate that an FAA form 7460-1 was completed unless

exemptions apply."

break;



case "3": // Noise Disclosure

Stipulation1.rawValue = "Applicant must demonstrate aircraft noise and overflight activity disclosure to

proposed occupants."

break;



case "4": // Fuel Dispensing and Storage

Stipulation1.rawValue = "Fuel dispensing and storage proposed for development projects must have

specific documented airport review and approval. Storage and dispensing of fuel

must be in accordance with Airpark Rules and Regulations."

break;



case "5": // Significant Changes Required Additional Review

Stipulation1.rawValue = "Significant changes to this project require additional project review by airport

staff."

break;



case "6": // Approval Valid for 1 Year

Stipulation1.rawValue = "This approval is valid for up to one year from the date it was signed. Further

review is not required prior to final plans approval unless substantial revisions are

made to the development plans anytime after the date this form was approved."

break;



default: // unknown value -- do nothing

bEnableTextField = false;

break;

}



Thanks - This is the first time I've had to use LiveCycle instead of the basic forms tools.



-----------------

Beckye Frey

Customer Relations Specialist

480-312-2743

bfrey@scottsdaleaz.gov



City of Scottsdale

Planning & Development Services Department

7447 E Indian School Road, Ste 105

Scottsdale, AZ 85251
August 2, 2007
I am new Adobe livecycle developer , my knowledge is Oracle and Sql , plSql . I want to design an adobe form, for which I have 2 drop down lists , one for all ministries , the other one is for all directorates which related to the selected ministry. The scenario is as follows:

The user will pick a ministry from the 1st drop down list, then for the 2nd dropdown, the list of all directorates that are belongs to the selected ministry should appear in order he can select the specified directory from the dropdown list. (no need for buttons).

I had tried the Stefan Camerons procedure in connecting a form to Db, and selecting specific record from a data base , the dropdown "Pick a Category" field is not working, also I had tried to copy his script into my form ,still is not working. Is there any method ? or maybe something I need to add to my script .



I am using adobe live cycle designer 7.1

Adobe reader is 7.0

the file is saved as pdf

data connection informations in the form are as follows :

1-DataConnection1.

Using OLEDB

database name is : Financial_DB_Forms (on the server)

OLEDB provider is :Microsoft OLEDB provider for SQL Server

Server : MOFNEO

Connecting string : Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Financial_DB_Forms;Data Source=MOFNEO;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=CPU-0900;Use Encryption for Data=False;Tag with column collation when possible=False

Table1 : Financial_Form_Ministry ( contains all ministries numbers and description)



2-DataConnection2. (same info. As above )

Table2 : Financial_Form_Directorate ( contains of all directorates for all ministries and description) .



Also can you please send me a telephone number and e-mail of any adobe developer that I can call him if I need any assistance .



Your help will be much appreciated,

Thanks,

Mariam Kadhimi

Tel : +973-39597575 (mobile)

Tel : +973-17575560 (Office)

Kingdom of Bahrain
New Participant
July 28, 2007
Your post is different form the Original Post and should be a separate post of it's own since it maybe lost and if the OP subscribes to this post by email, that person will be flooded with responses to your post.



In Acrobat, the Drop Down Box/List field does not support multiple selections only Combo List field does when that option is set for that field. Looking at the Drop Down List, I did not see an option to enable multiple item selection. Also LC D does not support the Acrobat JS "currentValueIndices" field property that is used to recover the multiple item selection array nor does it support the "getItemAt" field property that is used to get a selected entry from the combo list. So it appears this might not be possible.



For more information about Scripting in LC D see:



Scripting languages and resources (LiveCycle Designer 8.x)

http://www.adobe.com/cfusion/search/index.cfm?loc=en_us&term=livecycle+javascript
July 28, 2007
Using Adobe LifeCycle Designer for Adobe 8 I'm trying to populate a text field with multiple entries from a drop down list. I managed to be able to populate the text field for a single selection from the drop down list but am having trouble getting it to allow multiple selections from the drop down list to populate the text field keeping all of the selections within it. When I click another selection from the drop down list the first entry that populated the text field is replaced by the new entry, I need it to maintain all entries entered...please help.