on 04-19-2007 4:41 PM
Hi experts,
I have to open a window to show the value help for a field in a tableview (htmlb). After clicking a table row, the value is to be transferred into the calling page, the window is to be closed automatically. It's OK when using radio buttons instead of a tableview or with an additional button ( <input type="button" id="JAVA" value="SUBMIT" onclick="set_value('<%= gv_bname %>')"> ) to trigger the client event. But how can I fire the client event (onClick) without pushing the button (JavaScript?)
The calling BSP:
<htmlb:inputField id = "f4_user"
value = "<%= gv_bname %>"
showHelp = "TRUE"
onValueHelp = "ShowModalBox_f4user(document.main.f4.value)" />
The called BSP "F4":
Layout:
<% concatenate 'F1 = window.opener.document.forms.main.elements.f4.value =value;' into lv_string . %>
<htmlb:form...
<SCRIPT language="JavaScript">
function set_value(value)
{ <%= lv_string %> self.close(); }
</SCRIPT>
...
<htmlb:tableView id="users"
table="<%= gt_users %>"
onRowSelection="RowSelect"
selectionMode="SINGLESELECT" >
"f4", OnInputProcessing:
when 'RowSelect'.
lref_tableview ?= cl_htmlb_manager=>get_data(
request = request
name = 'tableView'
id = 'users' ).
if not lref_tableview is initial.
clear lv_ind.
lv_ind = lref_tableview->data.
clear pas_user_addr.
read table pat_user_addr into pas_user_addr
index lv_ind->row_index.
if sy-subrc = 0.
gv_bname = pas_user_addr-bname.
endif.
I've searched through the forum, but couldn't find the solution for my problem.
I'd appreciate your help!
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raja,
thanks a lot! I saw this thred before, but javascript was not called. Now I know, HTMLB objects (tableview or button) trigger server events, but I needed a client event for javascript. With the following coding it works!
<% if gv_bname is not initial. %>
<input type="button"
id="JAVA"
value="SUBMIT" onclick="set_value('<%= gv_bname %>')">
<script>
document.getElementById('JAVA').click();
</script>
<% endif. %>
But still I wonder, whether it's possible to call javascript directly after selecting a row in the tableview. The problem is, that a server event is triggered (onInputProcessing), and I didn't manage to call Javascript from Layout.
Do you have an idea?
best regards
That was my first idea, too. But Javascript was not processed after OnInputProcessing. The window was empty, but was not closed and the value was not transferred into the field on the main screen.
<% if gv_bname is not initial. %>
<SCRIPT language="JavaScript">
function set_value(value)
{ F1 = window.opener.document.forms.main.elements.f4_user.value =value;
self.close(); }
</SCRIPT>
<% endif. %>
Later I had the idea to fire a client event via a push button (HTML, No HTMLB).
I've no experience with Javascript, but I see in Debugger, that ABAP-Coding is processed, but Javascript not...
Thanks
<i><% if gv_bname is not initial. %>
<input type="button"
id="JAVA"
value="SUBMIT" onclick="set_value('<%= gv_bname %>')">
<script>
document.getElementById('JAVA').click();
</script>
<% endif. %></i>
the above can be replaced with the following htmlb code
<htmlb:button id = "JAVA"
onClientClick = "javascript:set_value('<%= gv_bname%>');"
text = "mubutton"/>
<script>
document.getElementById('JAVA').click();
</script>
<i>But still I wonder, whether it's possible to call javascript directly after selecting a row in the tableview.</i>
its possible check the demo application
sbspext_table/tableviewclient.bsp
Raja
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.