Skip to Content
author's profile photo Former Member
Former Member

Simulation of button push via JavaScript in HTMLB pages

Can anyone shed some light on simulatinh button clicks via JavaScript in HTMLB pages?

In "old-style" HTML BSP pages, you could execute the following:


to simulate clicking a "find" button; the oninputprocessing event handler would then execute. In HTMLB pages, the above JavaScript generates an error, as the object does not exist. Looking at the rendered page code, the HTMLB button with the "id = find" tag data is rendered as a JavaScript event.

As a quick & dirty shortcut, I defined an "type=submit" button and hid it with a <div> tag. Now I can access the hidden button via JavaScript as before, and the oninputprocessing BSP event handler fires, but the event ID for the hidden button is not set.

Can anyone tell me what I'm missing here?

Many thanks,


Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Jun 10, 2004 at 04:42 PM

    Hallo Dorian,

    What was that old saying about "one picture is worth a thousand words"? Let us see:

    <%@page language="abap"%>
    <%@extension name="htmlb" prefix="htmlb"%>
    <htmlb:content design="design2003">
       <htmlb:button id            = "btn1"    
                     text          = "Press Me"
                     onClientClick = "alert('off we go!');"
                     onClick       = "myClickHandler" />

    Does this do what you want? Be careful, I am no JavaScript expert, and suspect that the above might not work in Netscape. You will have to test.

    Also the ".click()" sequence is very much dependant on the HTML that is rendered for the button. Should this ever change in feature, of course you might have to recode that part.

    Why the hidden <div> with <input type=submit> does not work as expected? The reason is that all events of the HTMLB libraries are put into one central JavaScript function HtmlbSubmitLib. This function sets a number of hidden input fields that are required for the event handling, before the form is submitted.

    You could of course consider to trigger this function yourself. This function HtmlbSubmitLib's interface will not change anymore. However, the only way that we support on the server to build strings to call this, is if you have already an BSP-element available. So maybe this trick with the button above is easier.


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.