cancel
Showing results for 
Search instead for 
Did you mean: 

HTMLB + <htmlb:button>

Former Member
0 Kudos

Hello Friends,

I have a problem in using HTMLB, button in view of BSP page. Actually the problem is that I want to call the main contrller when user click on the button. But as in view there is not Event Handler, so while "onClick="event_1"/>, how I can handle this event!

here is a bit of code segment!

<htmlb:button width="10" onClick="event_1"/>

Does it work ?? like this if I call controller direct ??

<htmlb:button width="10" onClick="main.do"/>

With Regards,

Haider Syed.

Accepted Solutions (1)

Accepted Solutions (1)

maximilian_schaufler
Active Contributor
0 Kudos

Usually you specify the target controller for your form (and so all submitting elements) in the <form> tag:

<form action="main.do">

(sorry, mixed that up previously)

If you want to have this controller as a target just for this one button, then you might think about setting the target-attribute via a client-javascript using onClientClick.

Message was edited by: Maximilian Moder

Former Member
0 Kudos

Hi Syed,

What u wana do, or why dont u use form target ??

Message was edited by: Marek Jöricke

Message was edited by: Marek Jöricke

Former Member
0 Kudos

Hi Max,

Thanks for ur reply,

I am already haveing a form, which has several buttons, and I want for each button a new event,!

my problem is that when user click on button ( either onClick or onClientClick) how I will catch the event, as I need to open a new window using javascript?? for example when user click on button (OPENWINDOW) I need to have a event in which I can write a javascript code for opening a new window!

Many Thanks,

Haider Syed

Former Member
0 Kudos

<a href="/people/brian.mckellar/blog/2004/06/11/bsp-trouble-shooting-getting-help">BSP Trouble Shooting: Getting Help</a>

That's a nice place to start.

Then I would recommend you look at the <b>OnInputProcessing</b> event handler.

<i>OnInputProcessing: This guy is only called for event handling. At a very technical level: it is only called if the formfield onInputProcessing is in the incoming request. Otherwise, no event, and no jump in here.</i>

Then load in transaction se80, the BSP Application SBSPEXT_HTMLB, there is an example page "Button.bsp" which examples how to trap event froms a button click.

maximilian_schaufler
Active Contributor
0 Kudos

So, after making a small mistake in my last post (corrected now), I will try to bring some light into this situation:

First, summarize all the options you have:

Each form has a "target" (<b><form action="target_controller.do"></b>) which the browser will submit the form data to.

Note that this is different from the actual target-attribute (<b><form target="_blank"></b>), which is used to specify the location where the server-response will be displayed - you can let it be shown in a new window here.

Then, for form elements, you have the option to set client-side javascripts, using the <b>onClientClick</b> attribute. It's best if you just call a javascript function here, and define this function somewhere else in your code (javascript-file-include for example).

<htmlb:button ...
   onClientClick="yourFunction();" />

You can access your HTML elements (also form elements) using javascript, so changing the target or action parameter from within your function is possible!

To finish this post, there is the server-side event, specified by the <b>onClick</b> attribute, which is usually checked for in DO_HANDLE_EVENT (in case of MVC) or in OnInputProcessing (for non-MVC BSP pages, like Craig mentioned). But remember, this is server-side event!

So, with this info, you should be able to specify in more detail what you call "for each button a new event" - whether you mean server-side or client-side event ... maybe thinking about this alone will almost solve your problem.

Regards,

Max

Former Member
0 Kudos

Hi Craig,

I am using VIEW as my BSP page and not "page with flow logic", and in view, there are not event handler provided by BSP programming modle as in 'page in flow logic',

Thanks max, for ur reply,

so form your post I assume that on clicking the button with attribute onClientClick, I can call a Javascript Function, if so my problem seems to be solved, many thanks, I will let u know the result in next few hours,

with Best regards,

Haider Syed

Former Member
0 Kudos

Hi Max,

Many thanks for ur kind help, It does work.

you surely deserve 10 points now

see u later, bye

Haider Syed.

Answers (0)