Highlighted

Form Drop Down Script help...

Avatar

Avatar

mjogg11

Avatar

mjogg11

mjogg11

17-06-2008

I am trying to generate a form that contains drop down choices that are set based on the previous selection. In searching this forum I was able to find a example that contained a script that made these choices work. However, when I transferred the script to a different form it didn't work. I even made changes to the choices in the sample form without changing the destination fields and couldn't get it to work.



The form I'm trying to create will have a selection for business unit (hard coded)that would generate the selections in a department and fund drop down. They are organized horizontally in a line. The fund drop down will contain about 1500 selections.



Is their a script that would call the information from a data source as opposed to hard-coded values in the script itself? If so, would someone mind sharing it with me?



Thanks for your help. I'm new to LiveCycle but am very encouraged by what it can do.

Replies

Highlighted

Avatar

Avatar

_Aandi_Inston_

Avatar

_Aandi_Inston_

_Aandi_Inston_

18-06-2008

You may find it best to share what changes you made to the script, and

what happened when you ran it. That way we can help you understand

more of what you need to know about script programming.



Aandi Inston
Highlighted

Avatar

Avatar

mjogg11

Avatar

mjogg11

mjogg11

18-06-2008

Hi Aandi-<br /><br />The script I was playing with is below. Once I began to make changes to the variables the dropdown boxes went blank and were no longer associated with each other. I hope that helps. The original script was taken from an example that I found in the forums and referred to autoparts. <br /><br />Thanks again<br /><br />begin script-<br /><br />----- TopmostSubform.Page1.OrderSection.OrderItems.#variables[0].Example1::Example1 - (JavaScript, client) <br /><br />var oAssemblyParts = { <br /> Chasis: [ ["-","None"], ["Rear Bracket",205.95], ["Front Bracket",185.95], ["Long Support",44.95],["Front Bearing",48.95]],<br /> Clutch: [ ["-","None"], ["Plate 1",15.95], ["Plate 2",22.95], ["Inside Shaft",44.95],["Outside Shaft",32.95]],<br /> Brake: [ ["-","None"], ["Master Cylindar",139.95], ["Slave Cylindar",85.95], ["Pad",15.95], ["High Presure line",22.95]],<br /> Coolant:[ ["-","None"], ["Pump",35.95], ["Thermostat",19.95], ["Coolant Line",8.95],["Reservoir",17.95]]<br /> }; <br /><br />////////////////<br />// SetPartEntries()<br />//<br />// Function for setting the parts list based on the assmebly selection value<br />//<br />// This function is specifically setup to be called from the Change Event<br />// of the Assembly List. It will not work from another event because the <br />// "xfa.event.change" parameter is used<br />//<br />function SetPartEntries()<br />{<br /> // Since entries are added one at a time it is necessary to clear out the list<br /> PartList.clearItems();<br /> // The ComboBox value is not dependant on the list selection so we <br /> // have to also clear this<br /> PartList.rawValue = null;<br /> Price.rawValue = 0;<br /> <br /> // Grap the parts list from the master list and loop over it to fill <br /> // the List Field<br /> var aParts = oAssemblyParts[xfa.event.change];<br /> if(aParts && aParts.length)<br /> {<br /> for(var i=0;i<aParts.length;i++)<br /> PartList.addItem(aParts[i][0],aParts[i][1].toString());<br /> }<br />}<br /><br />////////////////<br />// SetPriceValue()<br />//<br />// Function for setting the price value based on the Parts selection value<br />//<br />// This function is specifically setup to be called from the Change Event<br />// of the Parts List. It will not work from another event because the <br />// "xfa.event.newText" parameters is used<br />//<br />function SetPriceValue()<br />{<br /> // If the export value is null or not a number then set the price to 0<br /> var newPrice = 0;<br /> newPrice = PartList.boundItem(xfa.event.newText);<br /> if(isNaN(newPrice))<br /> newPrice = 0;<br /> <br /> Price.rawValue = newPrice;<br />}