on 11-17-2009 5:03 AM
Hi,
In my adobe forms application, I have got two dropdowns. Based on the selected item on the first, the second dropdown also should change. ie, if in the first dropdown the third item is selected from the list, in the second dropdown also its third item should get selected.
How can this be done?
Thanks and Regards,
Shyam.
Hi Shyam,
You can get the selected index of a drop-down list for example in the exit event using the following script:
this.selectedIndex
. There is also a method
setItemState(integer, bool)
to set the state of an item (index as integer) to selected (the bool parameter). The method needs at least Reader 8 so your form will not work with older Reader versions.
And indexes are 0-based.
Regards,
Juergen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Populating field values as well as drop downs based on drop down selection can be done by triggering events through scripts. The below code will be written in Change Event of the Form element.
xfa.record.CONTROL_PARAM.ISR_EVENT.value = "ACTION_TYPE";
ContainerFoundation_JS.SendMessageToContainer(event.target,"submit","","","","");
Related coding to populate the values should be written in method u201CSCENARIO_PROCESS_USER_COMMANDu201D.
CASE user_command.
WHEN 'ACTION_TYPE'.
READ TABLE special_data INTO ls_special_data
WITH KEY fieldname = 'MASSN'.
g_massn = ls_special_data-fieldvalue+0(2).
IF sy-subrc = 0.
SELECT * FROM t530 INTO TABLE it_massg
WHERE massn EQ g_massn.
SELECT * FROM t530t INTO TABLE it_massg_txt
FOR ALL ENTRIES IN it_massg
WHERE massn EQ it_massg-massn
AND massg EQ it_massg-massg
AND sprsl EQ g_lang.
IF sy-subrc = 0.
LOOP AT it_massg INTO wa_massg.
ls_additional_data-fieldindex = sy-tabix.
ls_additional_data-fieldname ='MASSG_KEY'.
READ TABLE it_massg_txt INTO wa_massg_txt WITH KEY massg = wa_massg-massg.
CONCATENATE wa_massg-massg wa_massg_txt-mgtxt
INTO ls_additional_data-fieldvalue
SEPARATED BY space.
APPEND ls_additional_data TO additional_data.
CLEAR wa_massg_txt.
ENDLOOP.
ENDIF.
ENDIF.
I hope this would help you.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello. In my humble opinion it is not logical to have two connected drop-downs. I can imagine you have a drop-down for user selection and another field that displays some extra information for the selected item. But why would you need two connected dropdowns? Seem irrational for me. If you can provide more information about the business problem to solve, we can help you solve it. Regards, Otto
p.s.: If your only problem is to get an index of DD and use it, we can work on it too.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shyam,
Try writing the code on Action of the first dropdown. i.e get the element selected from the first dropdown, then by using this set the other dropdown value.
Hope this helps u.
Regards,
Poojith MV
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.