cancel
Showing results for 
Search instead for 
Did you mean: 

Clicking a htmlb:button via Java Script

Former Member
0 Kudos

Hi all!

I would like to 'click' a htmlb:button via Java Script.

Example with a html-button:

<htmlb:button id="b1" onClientClick="javascript:document.form_id['b2'].click()" text="Call Button 2"/>

<input id="b2" type="button" onclick="alert('2')">

Does anybody have an idea how it works with a htmlb:button?

Thanks!

Stefan

Message was edited by: Stefan Kittsteiner

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Stefan,

Use this

<script>

function submit()

{

return htmlbSL(this,2,'b2:b2Click');

}

</script>

<htmlb:button id="b1" onClientClick="javascript:submit()" text="Call Button 2" />

<htmlb:button id="b2" onClientClick="alert('I am clicked')" text="Button 2" />

b2Click is server event for button 'b2'.

You can also use <bsp:htmlbEvent> for more details see weblog <a href="/people/brian.mckellar/blog/2004/07/18/bsp-in-depth-using-the-htmlb-event-system In-Depth: Using the HTMLB Event System</a>

Regards,

Narinder Hartala

Former Member
0 Kudos

Thanks Narinder!

Since I have to reach the (htmlb-)button 2 in another iframe/application, I would need an client side event to trigger the button 2. Is there any possibility?

(I also cannot change the application in the iframe, since it is a Web Application Designer application...)

Regards,

Stefan

Former Member
0 Kudos

Hi Stefan,

It may be possible but I am not aware of it now,

If I will find something I will share.

Visit thread . See if it can help you in some way.

Regards,

Narinder Hartala

Former Member
0 Kudos

Hi Stefan,

See this code snippet. Perhaps it does your job:

function Click()
  {
 but = parent.body.document.getElementById("<button Id>");
 but.click();
  }

In the place of button ID give the ID of the button in the Iframe.

Regards,

Ravikiran.C

Former Member
0 Kudos

This is the solution of my problem!

Thanks Ravikiran,

thanks Narinder!

Answers (0)