Skip to Content
0
Former Member
Apr 19, 2007 at 03:41 PM

Fire onClick-Event for a button to call a JavaScript function

677 Views

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!