Yasushi Okubo wrote:
Hi, experts
I would like to create a simple text link that kicks off javascript by
onmouseover, but avoid to do submit() or go to another webpage, and I
also need to show the data stored in my backing bean.
The Html line could be like the following. I played with both
outputLink/outoutCommand, but it alway tries to display webpage or
submit a new request by "clicking" or onclick. I would like to disable
to submit for commandLink/outputLink for onclick. How could I do it ?
Or is there any other method other than outputLink/commandLink that can
avoid submit()/going to another page ?
<a href="_blank" onmouseover="doPopupMolWeight();"
onmouseout="close_window_mol();" >
'NeedToDisplayDataStoredInBackingBeanHere' </a>
I tried something like the following with outputLink, but it submits a
request to the server when I click the link after executing "javascript
doNothing()".
<h:outputLink value="#{value}" onclick="doNothing()"
onmouseover="doPopupMolWeight();" onmouseout="close_window_mol();" />
<h:commandLink value="#{value}" onclick="doNothing()"
onmouseover="doPopupMolWeight();" onmouseout="close_window_mol();" />
As with any Javascript event handler, you need to return false if you
want to prevent the default action from taking place. Add a 'return
false;' at the end of your doNothing() function [or, since that function
presumably doesn't do anything, you could just replace it with the
return in the onclick attribute.]
L.
- Re: question for outputLink/commandLink Laurie Harper
-