6 Replies Latest reply on Jan 19, 2010 5:03 AM by Ilya Shaikovsky

    Change style when commandLink is selected

    Tim Nguyen Newbie



      I have a list commandLinks to display and I want to change the css style of a link when it is selected. Is there an easy way to do that? I used oncomplete to change style but it is not working because the reRender resets the style back to original style. Thanks for your help

      Here is the code (not working):


              <c:forEach items="#{testBean.productNames}" var="productName" varStatus="linkStatus">
                   <a4j:commandLink value="#{productName}" styleClass="#{productName == selectedProduct ? 'productSelectedStyle': 'productStyle'}"
                      <f:param name="selectedProduct" value="#{productName}"/>