4 Replies Latest reply on Sep 11, 2009 10:17 PM by Tony Herstell

    Decoration and mesages not beign applied to file (is appearing in global area)

    Tony Herstell Master

      Seam latest, RF latest.


      I am decorating a field.


      <s:decorate id="entity_user_email_decorator"
           template="../../WEB-INF/pages/editDecorator.xhtml">
           <ui:define name="label">
                <h:outputText value="#{messages.entity_user_email_label}" />
           </ui:define>
           <ui:define name="content">
                <h:inputText id="registration_email" value="#{risingstars.user.email}" required="true" size="70">
                     <a4j:support event="onblur" ajaxSingle="true" limitToList="true" reRender="entity_user_email_decorator"/>
                </h:inputText>
           </ui:define>
           <ui:define name="hint">
                <s:formattedText value="#{messages.entity_user_email_hint}" />
           </ui:define>
      </s:decorate>






      <?xml version="1.0" encoding="UTF-8"?>
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
           xmlns:ui="http://java.sun.com/jsf/facelets"
           xmlns:h="http://java.sun.com/jsf/html"
           xmlns:f="http://java.sun.com/jsf/core"
           xmlns:s="http://jboss.com/products/seam/taglib"
           xmlns:rich="http://richfaces.org/rich">
      
           <div class="edit_decorator_area">
                <h:panelGrid columns="3"
                     columnClasses="edit_decorator_label_area, edit_decorator_tag_area, edit_decorator_field_area, edit_decorator_error_area"
                     width="100%">
      
                     <h:column>
                          <s:label styleClass="#{invalid?'error':''}">
                               <ui:insert name="label" />
                          </s:label>
                     </h:column>
      
                     <h:column>
                          <h:outputText styleClass="mandatory"
                               value="#{messages.general_mandatory_tag}" rendered="#{required}" />
                     </h:column>
      
                     <h:column>
                          <span class="edit_decorator_content_area #{invalid?'errorblock':'noerrorblock'}">
                               <h:panelGrid columns="1">
                                    <h:column>
                                         <s:validateAll>
                                              <ui:insert name="content" />
                                         </s:validateAll>
                                    </h:column>
      
                                    <h:column>
                                         <span class="edit_decorator_hint_area"> 
                                              <ui:insert name="hint" />
                                         </span>
                                    </h:column>
                               </h:panelGrid>
                          </span>
                     </h:column>
      
                     <h:column />
                     <h:column />
      
                     <h:column>
                          <ui:insert name="error_messages">
                               <s:message styleClass="error" />
                          </ui:insert>
                     </h:column>
      
                </h:panelGrid>
           </div>
      
      </ui:composition>
      







      Then I raise a message on the field:


      statusMessages.addToControlFromResourceBundle("registration_email", Severity.WARN, "user_email_already_exists_in_system");



      but it does not appear on the field.


      It seems to drop back to appearing at the top of the page in the messages area.


      The errors coming through from hiberante annotation errors seem to work fine.


      Any ideas?

        • 1. Re: Decoration and mesages not beign applied to file (is appearing in global area)
          Shervin Asgari Master

          You cannot put the id on the inputtext, but rather on the message tag, like this:




          <h:messages id="registration_email"/>



          • 2. Re: Decoration and mesages not beign applied to file (is appearing in global area)
            Tony Herstell Master


            <ui:define name="error_messages">
                 <s:message id="registration_email_error" styleClass="error" />
            </ui:define>



            with



            } else {
                 log.info("Failed on unique user Check.");
                 statusMessages.addToControlFromResourceBundle("registration_email_error", Severity.ERROR, "user_email_already_exists_in_system");
                 }
            



            No change.


            Bummer.

            • 3. Re: Decoration and mesages not beign applied to file (is appearing in global area)
              Tony Herstell Master

              Not even giving it a outputPanel helped (possibly needed as error is not usually shown)


              <ui:define name="error_messages">
                   <a4j:outputPanel>
                        <s:message id="registration_email_error" styleClass="error" />
                   </a4j:outputPanel>
              </ui:define>



              • 4. Re: Decoration and mesages not beign applied to file (is appearing in global area)
                Tony Herstell Master

                almost exactly the same construct works perfectly in another page:



                          } else {
                            log.info("Failed on Username Check.");
                            statusMessages.addToControlFromResourceBundle("forgot_password_username", Severity.ERROR, "email_user_unknown");
                        }





                                              <s:decorate id="login_email_decorator" template="/WEB-INF/pages/editDecorator.xhtml">
                                                   <ui:define name="label">
                                                        <h:outputText value="#{messages.entity_user_email_label}" />
                                                   </ui:define>
                                                   <ui:define name="content">
                                                        <h:inputText id="forgot_password_username" value="#{credentials.username}" required="true"
                                                             title="#{messages.entity_user_email_tooltip}" size="70"/>
                                                   </ui:define>
                                                   <ui:define name="hint">
                                                        <s:formattedText value="#{messages.entity_user_email_hint}" />
                                                   </ui:define>
                                              </s:decorate>




                Grrrr