cancel
Showing results for 
Search instead for 
Did you mean: 

htmlb button/image fire server event and client event

0 Kudos

Hi,

by pushing a button/image I want to navigate to another page using "onClick" and navigation->goto_page('nextpage.htm') which works fine with the onInputProcessing event handler.

Now, in addition I need to fire a Clientevent to call a javascript to refresh my side, from where I start to navigate which works also fine.

But it looks like only one of the to events are working.

I can either refresh my startpage (onClientClick) but then navigation to the next page will not work, or I can naviagte to the next page (onClick) but then refresh of startpage with Javascript will not work.

Any idears or hints are appreciated. Thx a lot and regards from

Michael

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

The details here are sketchy, but one quick solution might be to do the following. Use the <bsp:htmlbEvent> element to generate a JavaScript that will trigger a server side event. Then only include the onClientClick event. Change the JavaScript that you already have in the onClientClick to call your htmlbEvent generated JavaScript at the end. That way you should be able to finish whatever client side activities you need to do before you call the server event (and then your navigation).

athavanraja
Active Contributor
0 Kudos

both onClientClick and onClick should work for button or image. to isolate the problem may be try to run the following application and if it works and the same dosent work in your application, there may be somethingelse wrong.

sample application.

<u><b>page attribute:</b></u>

eventstring type string .

<u><b>layout:</b></u>

<%@page language="abap" %>

<%@extension name="htmlb" prefix="htmlb" %>

<htmlb:content design="design2003" >

<htmlb:page title=" " >

<htmlb:form>

<htmlb:button text = "Press Me"

onClick = "mybutton"

onClientClick = "javascript:alert('test');" />

<br>

<htmlb:image src = "ICON_EXECUTE_OBJECT"

onClick = "myimage"

onClientClick = "javascript:alert('test');" />

<br>

<%= eventstring %>

</htmlb:form>

</htmlb:page>

</htmlb:content>

<u><b>oninputprocessing.</b></u>

data: event type ref to cl_htmlb_event.

event = cl_htmlb_manager=>get_event( runtime->server->request ).

clear eventstring .

if not event is initial .

move: event->SERVER_EVENT to eventstring .

endif .

Check this and let us know.

Regards

Raja

Answers (1)

Answers (1)

0 Kudos

Thank you,

I will have time to investigate this in more detail later on this week. It might be possible that it has also to do with the design of the application, because we use frames and are calling pages in the frames.

because of frames and javascript can leed to browser specific results, we decided most likely to change whole design of application, because later on this will be an extranet application.

thank you again and regards from Michael