on ‎2010 Sep 29 7:50 AM
Hello folks,
I hope this threads fits this forum. It strongly related to the WCUIF but also JavaScript.
The setting:
I got a view that is displayed in a DIV container. This view got a standard <thtmlb:button> which is triggering a round trip when pressed.
When I press the button manually by mouse a correct server roundtrip is done. Delta Handling takes care that only this one view is refreshed. Everything is wonderful.
Now the issue:
I need to "press" this button using JavaScript. It is no problem to get a handle to the correct button and JavaScript provides two methods focus() and click() to call both JavaScript functions that are triggered when the button is pressed manually.
The coding looks like this
var button = getElementById('Id of my button');
button.focus();
button.click();
Now a server roundtrip i done, but it seems to be a roundtrip for the whole WebClient. Even worse: The UI freezes with the spinning "Please Wait..." showing.
Does anybody know how to do a correct, delta handled round trip that is invoked not by the user but JavaScript?
I already tried putting and calling the bsp:htmlbEvent. It behalves like the button described above.
Thankful for any pointers!
cheers Carsten
Request clarification before answering.
Another day of debugging solved the problem.
When using the thtmlbAjaxRequest do not start another request while you are still in the result handler of the first. Put the button.click() in another function and everything works as expected.
cheers Carsten!
Edited by: Carsten Kasper on Sep 29, 2010 5:19 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Carsten,
I am also trying the same thing but not been able to trigger the event programatically. below is my code:
<bsp:htmlbEvent name = "fireEvent"
id = "fireEvent"
p1 = "p1"
p2 = "p2" />
<thtmlb:button id = "mybutton"
text = "Submit"
onClientClick = "sessionexit( );" />
<script language="javascript" type="text/javascript">
function sessionexit( )
{
var button = document.getElementById("<%= controller->component_id %>_mybutton");
button.focus();
button.click();
return fireEvent('Submit');
}
</script>
Could you please give me some heads up on this? Thanks for your help.
Regards,
Ashish
Hi Ashish,
if I remember correctly, it is almost 2 years by now, for me the problem was that I tried to trigger the server roundtrip in a handler method automatically called by the THTMLB Ajax library. This does not work. Do not know why exacatly, it just doesn't.
Solution in my case:
Set a helper variable in the ajax handler and call an additional method with window.setTimeout() to trigger the roundtrip.
As I switched customers a while ago, I do not have access to the system where this issue was solved to recheck.
cheers Carsten
| User | Count |
|---|---|
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.