English 中文(简体)
How to disable a4j:commandLink
原标题:How to disable a4j:commandLink

I have an a4j:commandLink and I want to disable it when it is clicked. I write the code like this:

    <a4j:commandLink id="link"
       onclick="this.disabled=true;"
       action="#{jobAction.action}"
       <h:graphicImage value="/img/last-enable.gif" />
    </a4j:commandLink>

but it does not work. The same code can work in the a4j:commandButton, why a4j:commandLink can t? Anyone can tell me how to implement that function? Thanks

问题回答

If you initially set onclick="return false;" you cannot run the action even once. So you have to set it dynamically as below.

<a4j:commandLink onclick="this.setAttribute( onclick ,  return false; );"/>

<代码>残疾的财产仅适用于inputs。

请尝试return false;,改为特殊风格,以便链接能照顾残疾人。

<a4j:commandLink id="link"
   onclick="return false;"
   action="#{jobAction.action}"
   style="text-decoration: none; color: #dedede; cursor: default;"
   <h:graphicImage value="/img/last-enable.gif" />
</a4j:commandLink>




相关问题
richfaces keepAlive not working

I have a mediaOutput tag which, in its createContent attribute, requires the backing bean to be in a certain state. A list of values, which is filled in an init method, must be available. I therefore ...

JSF a4j:commandButton not working when disabled is set

When I include a disabled attribute on an a4j:commandButton, the button s action is not performed. Taking the disabled attribute out causes it to work properly. I am not doing any special ...

Does rich:messages tag need to be in an a4j:region?

The web app I m working on sometimes has a <rich:messages> tag inside of an <a4j:region> tag, sometimes not. I m guessing that the messages tag needs to be inside of an a4j region, but ...

JSF ReRender support with selectBooleanCheckbox

I have a JSF page on which I want to have a checkbox that, when clicked, will add/remove certain other form fields from the page. Here is the (simplified) code I currently have for the checkbox: <...

JQuery, JSF and a4j:commandLink

I have a problem with using jQuery Dialog and Ajax submit in JSF. I have the following code for displaying Dialog windows: <script type="text/javascript"> ...

JSF a4j:support with h:selectManyCheckbox

I m having trouble with a JSF selectManyCheckbox and A4J support. The purpose is to run some action when a checkbox is selected. This works perfectly in Firefox. Yet, when testing in any IE (ie6 / ie7 ...

热门标签