on 11-28-2003 10:50 AM
Currently developing in the JSP Dynpage model in EP 5, but will also be developing in EP 6, once we get our hands on the installer.
My Question is, with the above environment, how do you force a call to the JSP method from a javascript call, in the case where you are using Client Side eventing, and want to mimic a Button Click, etc...
In the JSP page I have a HTMLB button defined as
<hbj:button id='Load' text="Load WorkBench" onClick="clickLoad" onClientClick="Validate()"/>
and the method clickLoad is in my Dynpage to handle when the user clicks on it.
I also know how to cancel the submit process of the button click in a call from the Validate() function with:
htmlbevent.cancelSubmit=true;
But, if I was in a seperate javascript function that is subscribed to some client event, how would I make the iView call that method clickLoad, as if the user clicked on that button. Also, would like to know how to do this genericly and not just for a button. It was the easiest way to explain it using a button.
Vivek,
If you don't want to button to show, you can hide it in a span with the style-sheet with similar code below:
<SPAN STYLE="visibility: hidden">
<hbj:button id='buttonEvent' text="" onClick="clickEvent"><% strbuttonEventId = yourContext.getParamIdForComponent(buttonEvent); %> </hbj:button>
</SPAN>
You can then trigger the button's onClick event via Javascript call such as:
document.all.<%=strbuttonEventId%>.click();
This should work fine, and i've used the above solution for the trigger of the event.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jorge,
I did the same as what you have mentioned.
But for some reason I could n't get it done.
I declared strTest as String(also tried as Object) at the top of the JSP.
While in javascript, tried printing strTest in an alert stmt.It printed null for strTest.
Am I missing something here?
Your help will be really appreciated.
Thanks
One method that did work was to add an htmlb element into the page, that has an onClick event, such a button. Set it to be invisible via stylesheets, then trigger the client button click via javascript.
You will then be able to have the server side event handler kick in, and do whatever is needed.
Hope that helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If I understand your question, you would need the listener iView to invoke submit() on the form of the iView that has the "clickLoad" Dynpage event handler.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jorge,
I'm curious to know if you were able to get this working based on Will's suggestion to invoke the submit() object. I've been encountering the same issue you are describing and am looking for a solution. I tried Will's solution, but I couldn't get it working. If you got this working, I would be interested in seeing a code example if possible.
Thanks,
Kevin
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.