on 04-21-2011 11:26 AM
I would like to do implement some client-side logic in a BSP application. When the user selects a value in a dropdownListBox, I need to get the selected value.
I thought I can implement a function for the onClientSelect parameter, but this does not return the current DOM element.
How do I get at the selected value? Will this also work for other derivatives like THTMLB?
Thanks,
Martin
Search the forum, this has been discussed many a times before.
<htmlb:dropdownListBox id = "DDLB1"
nameOfKeyColumn = "NAME"
nameOfValueColumn = "VALUE"
table = "<%= tab1 %>"
onClie ntSelect = "java script: dd = doc ument.getElem entById('DDLB1'); al ert(dd.value);"
width = "150" />
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Durairaj,
This does not seem to work, because SAP prepends its own identifier to the ID you specify, so "product_type" can become
"C8_W24_V25_V35_product_type" or something, and then the document.getElementByID returns null.
I am using THTMLB though, so I am not sure if this makes a difference.
Regards,
Martin
I managed to resolve the issue. After doing some debugging with Firebug, I found that inside my javascript code fragment, I have access to a htmlbevent object, which contains information about the HTMLB event that was fired.
To get the selected value, I can do the following in the code fragment:
htmlbevent.srcElement.value
htmlbevent.srcElement returns the element from which the event originated, in this case my dropdownlistbox.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
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.