You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by dancantong <da...@hotmail.com> on 2008/02/28 10:20:52 UTC

How to create a button that doesn't submit a form

Hi!
I wonder if it's possible to create a JSF button that redirects to a link
and doesn't submit the form.
I need this because I'm using ICEFaces and I would like to include a back
button that doesn't submit the form (the form is validated in real time with
AJAX).
I know there is an outputLink tag that does it but I would like to have a
button instead.
-- 
View this message in context: http://www.nabble.com/How-to-create-a-button-that-doesn%27t-submit-a-form-tp15732524p15732524.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: How to create a button that doesn't submit a form

Posted by Andrew Robinson <an...@gmail.com>.
>  <h:commandButton value="#{bundle.back}"
>  onclick="javascript:history.back();return false;"/>

or <button onclick="javascript:history.back();">#{bundle.back}</button>
or <input type="button" onclick="javascript:history.back();"
value="#{bundle.back}"/>

This assumes JSF 1.2 or facelets.

Re: How to create a button that doesn't submit a form

Posted by Nitin Deshmukh <de...@yahoo.com>.
I use this

<h:commandButton value="#{bundle.back}"
onclick="javascript:history.back();return false;"/>

It works fine for me.


Nitin

--- dancantong <da...@hotmail.com> wrote:

> 
> Hi!
> I wonder if it's possible to create a JSF button
> that redirects to a link
> and doesn't submit the form.
> I need this because I'm using ICEFaces and I would
> like to include a back
> button that doesn't submit the form (the form is
> validated in real time with
> AJAX).
> I know there is an outputLink tag that does it but I
> would like to have a
> button instead.
> -- 
> View this message in context:
>
http://www.nabble.com/How-to-create-a-button-that-doesn%27t-submit-a-form-tp15732524p15732524.html
> Sent from the MyFaces - Users mailing list archive
> at Nabble.com.
> 
> 



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping