You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Steve Torrefranca <st...@branders.com> on 2007/02/22 21:40:09 UTC

preventing form submission

Hi,

How do we prevent form submission?  I have a link that opens a new window:
<t:commandLink value="LINK"  
onclick="window.open('attachments.xhtml?commEmailID=#{communication.id}')" 
/>

My problem is, that the form that has the link gets submitted to the 
server as it opens a new link.  How do we prevent such behavior?

Thank you

-Steve

Re: preventing form submission

Posted by Steve Torrefranca <st...@branders.com>.
Simon/Jeff

I tried "return false" and it worked.  what is weird though is that i tried

function submitThis(){
    window.open('attachments.xhtml');
    return false;
}

and it did not work. hmmmm javascript....

Let me also try t:outputLink; wait let me edit my tomahawk taglib first.

Thanks

-Steve







Simon Kitching wrote:
> Simon Kitching wrote:
>> Steve Torrefranca wrote:
>>> Hi,
>>>
>>> How do we prevent form submission?  I have a link that opens a new 
>>> window:
>>> <t:commandLink value="LINK"  
>>> onclick="window.open('attachments.xhtml?commEmailID=#{communication.id}')" 
>>> />
>>>
>>> My problem is, that the form that has the link gets submitted to the 
>>> server as it opens a new link.  How do we prevent such behavior?
>>
>> This is a common javascript problem: add ";return false" to your 
>> onclick attribute.
>
> Umm..and what Jeff said too :-). Presumably t:outputLink is also what 
> you want..
>
>


Re: preventing form submission

Posted by Simon Kitching <si...@rhe.co.nz>.
Simon Kitching wrote:
> Steve Torrefranca wrote:
>> Hi,
>>
>> How do we prevent form submission?  I have a link that opens a new 
>> window:
>> <t:commandLink value="LINK"  
>> onclick="window.open('attachments.xhtml?commEmailID=#{communication.id}')" 
>> />
>>
>> My problem is, that the form that has the link gets submitted to the 
>> server as it opens a new link.  How do we prevent such behavior?
> 
> This is a common javascript problem: add ";return false" to your onclick 
> attribute.

Umm..and what Jeff said too :-). Presumably t:outputLink is also what 
you want..


Re: preventing form submission

Posted by Simon Kitching <si...@rhe.co.nz>.
Steve Torrefranca wrote:
> Hi,
> 
> How do we prevent form submission?  I have a link that opens a new window:
> <t:commandLink value="LINK"  
> onclick="window.open('attachments.xhtml?commEmailID=#{communication.id}')" 
> />
> 
> My problem is, that the form that has the link gets submitted to the 
> server as it opens a new link.  How do we prevent such behavior?

This is a common javascript problem: add ";return false" to your onclick 
attribute.

Re: preventing form submission

Posted by Jeff Bischoff <jb...@klkurz.com>.
Use h:outputLink instead of commandLink

Steve Torrefranca wrote:
> Hi,
> 
> How do we prevent form submission?  I have a link that opens a new window:
> <t:commandLink value="LINK"  
> onclick="window.open('attachments.xhtml?commEmailID=#{communication.id}')" 
> />
> 
> My problem is, that the form that has the link gets submitted to the 
> server as it opens a new link.  How do we prevent such behavior?
> 
> Thank you
> 
> -Steve
> 
> 
>