You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Emily Gu <e2...@gmail.com> on 2006/03/25 21:42:32 UTC

How to disable commandLink button after it is clicked once?

Hi,

Any recommend way to disable the commandLink button after a user click it
once? JavaScript this.disabled=true, it seems only giving the visual effect
as the the button is disabled but it still submits twice if I click it
twice. Any help is greatly appreciated.

Thanks,
Emily

RE: How to disable commandLink button after it is clicked once?

Posted by "Yura.Tkachenko" <Yu...@muranosoft.com>.
Hi, Emily

I didn't said use always onclick="return false;"

 

I only said about something like that:

 

<h:commandLink binding="#{bean.linkAdd}"  action="#{bean.onAdd}"/>

 

..... Java code

.........

public void onAdd() {

.......

 // no need to execute onAdd

 linkAdd.setStyleClass("disableLinkClass"); // apply style to disable link

 linkAdd.setOnClick("return false;"); // break server-side action for this
link

.........

}

 

Or you can implement another scenario for this.

 

Best wishes,

Yura.

 

  _____  

From: Emily Gu [mailto:e2005g@gmail.com] 
Sent: Saturday, March 25, 2006 11:50 PM
To: MyFaces Discussion
Subject: Re: How to disable commandLink button after it is clicked once?

 

Hi,

 

  Thanks for your reply. After I did this, the form is never submitted.

 

   onclick = "this.disabled=true; document.myForm.submit(); return false;"

 

Thanks,

Emily



 

On 3/25/06, Yura.Tkachenko <Yu...@muranosoft.com> wrote: 

Hi,

Try to setup onclick handler after you clicked on the link like this:

 

<h:commandLink .. Onclick="return false;" />

 

In this case by onclick won't be submit.

 

Thanks,

Yura.

 

  _____  

From: Emily Gu [mailto: e2005g@gmail.com] 
Sent: Saturday, March 25, 2006 10:43 PM
To: users@myfaces.apache.org
Subject: How to disable commandLink button after it is clicked once?

 

Hi,

 

Any recommend way to disable the commandLink button after a user click it
once? JavaScript this.disabled=true, it seems only giving the visual effect
as the the button is disabled but it still submits twice if I click it
twice. Any help is greatly appreciated. 

 

Thanks,

Emily

 


Re: How to disable commandLink button after it is clicked once?

Posted by Emily Gu <e2...@gmail.com>.
Hi,

  Thanks for your reply. After I did this, the form is never submitted.

   onclick = "this.disabled=true; document.myForm.submit(); return false;"


Thanks,
Emily



On 3/25/06, Yura.Tkachenko <Yu...@muranosoft.com> wrote:
>
>  Hi,
>
> Try to setup onclick handler after you clicked on the link like this:
>
>
>
> <h:commandLink …. Onclick="return false;" />
>
>
>
> In this case by onclick won't be submit.
>
>
>
> Thanks,
>
> Yura.
>
>
>  ------------------------------
>
> *From:* Emily Gu [mailto:e2005g@gmail.com]
> *Sent:* Saturday, March 25, 2006 10:43 PM
> *To:* users@myfaces.apache.org
> *Subject:* How to disable commandLink button after it is clicked once?
>
>
>
> Hi,
>
>
>
> Any recommend way to disable the commandLink button after a user click it
> once? JavaScript this.disabled=true, it seems only giving the visual
> effect as the the button is disabled but it still submits twice if I click
> it twice. Any help is greatly appreciated.
>
>
>
> Thanks,
>
> Emily
>

RE: How to disable commandLink button after it is clicked once?

Posted by "Yura.Tkachenko" <Yu...@muranosoft.com>.
Hi,

Try to setup onclick handler after you clicked on the link like this:

 

<h:commandLink .. Onclick="return false;" />

 

In this case by onclick won't be submit.

 

Thanks,

Yura.

 

  _____  

From: Emily Gu [mailto:e2005g@gmail.com] 
Sent: Saturday, March 25, 2006 10:43 PM
To: users@myfaces.apache.org
Subject: How to disable commandLink button after it is clicked once?

 

Hi,

 

Any recommend way to disable the commandLink button after a user click it
once? JavaScript this.disabled=true, it seems only giving the visual effect
as the the button is disabled but it still submits twice if I click it
twice. Any help is greatly appreciated. 

 

Thanks,

Emily