Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Dropdown Lists - linking 2 together

Avatar

Former Community Member
Hello,

I'm trying to recreate my company's document 'signoff sheet' as a form. I need to associate the doc to a product line, and then a product family, which is a subset of its product line.



So I'd like to offer two drop down lists. The first would be product line, and then the second would offer the product families, depending upon what was selected in the first.



I tried to mimic the steps listed here:

http://www.acrobatusers.com/tutorials/2007/js_list_combo_livecycle/



But my second dropdown only gave me 'Hello'.



Any help would be appreciated.



-David
9 Replies

Avatar

Former Community Member
Where will the data for the dropdown lists come from? Are you intended on retrieving it from an external source or hard coding it into the logic of the form?

Avatar

Level 2
Hi all,

I have the same problem. But my drop down list (ddl) are related to a access db. On first ddl I choose country and I want the second ddl is to be filled with selected country's cities.

Any idea?

Thanks in advance

Avatar

Former Community Member
You can make a connection from the form to a DB like access but that means that you will have to create a DSN connection on each machine that uses the form. The DB woul have to be made accessible (stored in a public place) for all users to get to it (like a shared folder).



To be able to make a DB connection work in Reader the form must be Reader Extended by LiveCycle Reader Extensions Server otherwise reader will not allow it. This is not required if Acrobat is the client.



With these stipulations do you still want to proceed? Is there another place to get the data?

Avatar

Level 2
Hi Paul,

Thanks for your answer. Yes I still need more info under this stipulations.



I have created a access db and pdf (you can reach from here http://www.medyasoft.com.tr/poc/tuik/ddl.rar). Pdf has 2 drop down lists (DDL) with db connections. When I choose "A" on first DDL, "a" must be the only option on second DDL.



I wrote this script on first DDL's exit event. But notihng happens. No error message or no action. Second DDL still shows all lists?!!???



form1.#subform[0].buyuk::exit - (FormCalc, client)

var sCategoryId = buyuk.rawValue

var oDataConn = Ref(xfa.sourceSet.DataConnectionKUCUK.clone(1))

oDataConn.#command.query.commandType = text

oDataConn.#command.query.select = concat(SELECT * FROM KUCUK WHERE KUCUKID= , sCategoryId)

oDataConn.open()



Thank you for your cooperation.

Murat Kuru

Avatar

Former Community Member
There are a couple of problems with yor form. The SQL statement you are exectuing is incorrect. It should be in the format:



Select * from database where columname = 'value'



You are not including th esingle quotes in your statement.



It also seems that the dynamic binding is only working on form load and not dynamically when you programmatically open the connection. The call to the DB is working so you will have to extract the data from the datadom yourself. If you use:



xfa.datasets.data.root.DataConnectionKUCUK



It will give you access to the data that is being returned and you can populate the dropdownlist yourself.



To see the structure put a textField on the form and make it multiline then use the command:



TextFieldName.rawValue = xfa.datasets.data.saveXML("pretty")



One last thing....the column in your database is defined as an Integer and the value in the select statemnt is a string so you will get a mismatch. Either change the db to a string or cast the value in the selct statement as an int. The ddlist cannot return an int but only a string.

Avatar

Level 2
Hi Paul,

Thank for your reply. It was very helpful so we could solve the problem. But now we have another one..



When I save my form as static pdf it works fine. But if i save as dynamic xml then it doesn't work. Second DDL's data changes depending on first DDL's choice. But when I choose on second DDL and exit it it always shows the first record??.



I have to save my form as dynamic xml because I have visible/hidden tables on my form.



Do you have any suggestion?



Thanks..

Avatar

Former Community Member
In the last screen of the dataconnection configuration you have to set the Delayed Open checkbox to on. This will delay the opening of teh DB until your code tells it to open.