4 Replies Latest reply on Apr 19, 2011 6:19 AM by ilya_shaikovsky

    Hyperlink rich:messages to auto focus on invalid component

    jonnie119

      Hi there,

       

      I was wondering if it is feasible to make the messages in <rich:messages/> clickable, enabling the user to autofocus on invalid components and  correct the erroneous input. It would be doable to set up a custom message class, extending the standard message with the client-id and then iterate in a table over those message with an output-label and pull it from flash, where a phase-listener has put it before.

       

      <h:dataTable id="messages" value="#{flash.errors}" var="msg" rendered="#{flash.errorsOccured}" border="1">
           <f:facet name="header">
                <h:outputText value="customErrors" />
           </f:facet>    
           <h:column>
                <h:outputLabel value="#{msg.message}" for=":#{msg.clientId}" styleClass="errorStyle"/>
           </h:column>
       </h:dataTable>
      

       

      However this temporary solution doesn't use <rich:messages/> and the new solution should also work for client side validation, so no phase listeners...

       

      Has anyone done such a thing yet? I searched the forum for similiar questions but didn't find an appropriate answer on that topic.

       

      Any help or hint would be greatly appreciated!