You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Rønnevik, Eivind <ei...@kadme.com> on 2006/07/31 16:28:50 UTC

commandLink and onclick event

Hi!
 
Can anyone tell me why something like this would work:
<t:commandLink value="#{messages.deleteRow}" action="#{selectRowHandler.deleteRow}" onclick="if (!confirm('Are you sure you want to delete this record?')) return" />

But that a similar approach (firing the java script AND the action) doesn't?
 <t:commandLink value="#{messages.viewInfo}" action="#{selectRowHandler.setSelectedItem}" onclick="openPopupWindow(this); return false;" >
        <t:updateActionListener property="#{selectRowHandler.selectedItem}" value="#{item}" />
</t:commandLink>

Basically, the first link fires BOTH the javascript and the action, but the second one fires only the javascript. Why should the contents of the script have something to say for if the action is triggered or not?

I thought that the commandLink was capable of triggering both, anybody have some experiences with this?

Regards, 

Eivind