I am creating a BSP with an htmlb button element. I fully expect to land in the OnInputProcessing event handler when I press the button, but I do not. I also do not land in this event in any of the sample BSP's (i.e. HTMLB_SAMPLES, SBSPEXT_HTMLB). Rather, I get only a "javascript:void(0)" message. Or, I get an error message of "Object expected".
Conversely, if I set "submitonEnter" to "TRUE" for an input field, I land in OnInputProcessing. I've proven this in debug mode. I've also been able to place an image that can be clicked to initiate OnInputProcessing.
How can I land in OnInputProcessing when pressing an htmlb button? Also, the help text (perhaps for someone who knows nothing about web programming like me) is not very helpful regarding the OnClick property of a button. Can you shed some light on that?
I've received an initial response (thanks, Brian), below.
***************************************************************************************************************
Now let us look at the button code. You effectively have three permutations you can write, and their meanings. Here "..." is for the id, text, tooltip etc parameters.
(1) <htmlb:button ... onClick = "myHandler" />
This onClick here is just a symbolic string. It means you are interested in the event of the button at the server. The myHandler is a string you can use to dispatch events somewhere, etc. (Sending events to server is just a submit of the HTML form.)
(2) <htmlb:button ... onClientClick = "alert('Hit me more!');" />
In this case no onClick handler is set. Thus no event is required at the server. When the user clicks the button, the onClientClick string is executed in the browser. This must be JavaScript code.
(3) <htmlb:button ... onClick = "myHandler" onClick="alert('Hang 10, we going to roundtrip')" />
This does both of the above. First execute the Javascript, and then send the event to the server (if not canceled).
(4) <htmlb:button ... />
This button has no events, and it will not help to be pressed. So effectively we render this button as disabled.
I would seriously recommend that you play with our test BSP applications. They all use buttons. See BSP applications: HTMLB_SAMPLES, SBSPEXT_HTMLB, SBSPEXT_XHTMLB and SBSPEXT_PHTMLB (>sp30).
***************************************************************************************************************
But, from this response, I still do not know how to land in OnInputProcessing. Furthermore, adding the onClientClick phrase from number 2 above did not do anything in my test.
Further help would be much appreciated!
Thanks,
Manny
Hallo Manny,
Nice to make a new thread, but more recommended would have reading the text. Point 2 would not help you at all. I explicitly wrote that for onClientClick NO (in uppercase!) event is send to the server. It is handled in the browser!
Now let me make two remarks, and then I think that you should invest another hour.
(1) Did you try any of our examples? I listed them above. Do the simple test of making a copy of SBSPEXT_HTMLB/button.bsp, and delete everything to the minimum until it works?
(2) Try to write a five line test program to show it work or not work. If you post the code here, we would of course do the review for you. We don't spare in comments!
So I now did (1) and (2) above and have:
<%@page language="abap"%>
<%@ extension name="htmlb" prefix="htmlb"%>
<htmlb:content>
<htmlb:page>
<htmlb:form>
<htmlb:button id = "myButton"
text = "HitMe!"
onClick = "myButtonClick" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
Of course this worked immediately (see the onClick!), and I landed in the onInputProcessing method.
Now let me place a guess to your 5 lines of code (which we have not seen yet). I suspect one of two errors:
(1) You do not have the <htmlb:form> tag?
(2) You have it, plus you defined an action to point onto another page.
(3) Everything is actually working correctly, and you are just not landing in the debugger (there are many reasons for this).
I will tip to (1) until proven otherwise.
Now, you did play with our examples?
bye, brian
Add a comment