Expand my Community achievements bar.

List box selections to a Text Box.

Avatar

Former Community Member
I am currently building a form that uses the addInstance feature to allow for more than one security registration per page. In the form, we have a drop down menu with a list of security related choices (e.g., user can have option 1, 2, 3, 4, 5 for security). I would like a script that allows the users to make choices from this drop down menu, and those choices are recorded in a text box next to the drop down. This save the space of having to provide Radio Buttons for each choice. Any help would be appreciated as I am very new to Livecycle designer.
9 Replies

Avatar

Former Community Member
Ms Gorham,



What you want to do is rather simple but I am wondering why you would have someone select something in a drop down and then want to put that in another field. Why not just have them select the level in the drop down and leave it at that?



Rick Kuhlmann

Avatar

Former Community Member
Rick,



We have about 35 choices the user can make in the drop down box (list box) and the person can have 1 or all 35 choices. Most users of this form will print out the results, therefore we are unable to just leave it where they can select multiple options from the drop down (list box) menu. So, we need the selections they make from this list to print somewhere on the form, so that it can be printed, signed and turned into our security staff. We were going to use radio boxes, but having that many takes up way to much space and looks very cluttered. Hope that helps?

Avatar

Former Community Member
Ms. Gorham,



Here is what you can do to acheive the desired effect:



1. In the "change" event of the drop down or list box add the following:



var nt = xfa.event.newText;



if (TextField1.rawValue == null) {

TextField1.rawValue = nt;

}

else {

var tf = xfa.resolveNode("Page1.TextField1").rawValue;

TextField1.rawValue = (tf + "\n" + nt);

}



Now in this js, the TextField1 is the text field you want the selections copied into. Page1 is name I gave to the page subform that contains the objects on the Body Pages tab.



2. Select the TextField1 object. On the Layout Pallete click the Expand to fit checkbox under Height:



3. Open the Hierarchy palette. Select the page subform (Page1 for me) and on its Object palette/Subform Tab change the Type: to Flow Content. Then change the Flow Direction to: Western Text NOTE: This will make all your objects on that page jump in the design area. You cannot reposition objects in a flow subform.



This will get you the desired result of copying the selections into the textfield and the textfield will grow to meet the demand



Rick Kuhlmann

Avatar

Former Community Member
Rick



Thank you so much. This worked exactly to what I was looking for. I appreciate you helping me!!!



Diane

Avatar

Former Community Member
Rick



One more question: Is there a way to only store a portion of the selection from the drop down box. Say the drop down menu says: "121 - Pre-Encumbrances", but I want to store and print only the "121" option. What is the easiest way for that?



Thanks again!!!

Avatar

Former Community Member
Ms. Gorham,



Just replace the current js with the following:



var nt = xfa.event.newText;



if (TextField1.rawValue == null) {

nt = nt.substr(0,3);

TextField1.rawValue = nt;

}

else {

var tf = xfa.resolveNode("Page1.TextField1").rawValue;

nt = nt.substr(0,3);

TextField1.rawValue = (tf + "\n" + nt);

}



Rick Kuhlmann

Avatar

Former Community Member
Again to you Rick I say, Thank you so much!!! Your help has been greatly appreciated!!!

Avatar

Former Community Member
Rick,



I found your discussions with Ms. Gorham very useful in solving my own issues in understanding drop down lists. In keeping with your discussions above is there also a way to make it so that only one instance of each of the multiple selection from the drop down list will only be allowed in the text field? The desired effect is to ensure that no duplicate entires are listed in the text field. Any assistance is greatly appreciated.