2 Replies Latest reply on Apr 15, 2008 9:41 AM by balazs_hu

    problem with rich:message in IE

    balazs_hu

      Hi,

      I have a big problem. I have a web page, based on richfaces, and I have a modalPane wich will pop up, if everything is OK on the form (so no validation message occured on the page).
      I succesfully solved it and it worked in Firefox, but after it I realized it don't work in Internet Explorer. Here is my solution:

      the commandButton which create the popup:

      <a4j:commandButton value="#{msg.button_borrow_now}"
       onmouseover="this.className='on_button'"
       onmouseout="this.className='button'"
       styleClass="button"
       oncomplete="modalopen('borrow_form:error', 'popup_borrow_confirm', {width:450, top:200});">
      </a4j:commandButton>


      it calls the modalopen script:

      function modalopen(matchStr, modalPanel, params) {
      
       var s = document.getElementsByTagName("span");
       for (i=0; i<s.length; i++) {
       if (s.id != null && s.id.match(matchStr) && (s.textContent != '' && s.textContent != undefined)) {
       return;
       }
       }
       Richfaces.showModalPanel(modalPanel, params);
      };
      


      it examins if there are no validation message on the page (every validation message occures as a span tag, and it contains text which is not empty string and not undefined).

      You can see the borrow_form:error parameter. It is important because every rich:message tag's id has this kind of prefix, and in the script I am looking for such span tags, which match. An example:

      <rich:message id="error_requestDeadline" for="input_requestDeadline" ajaxRendered="true" styleClass="error"/>


      So my problem is, if there are validation messages on the richfaces page and I am using Internet Explorer, the validation span tags don't contain any text inside them. It is interesting for me, because the validation messages are visible, but if I search for them in the source of the page, I can't find them at all. So my script can't it either of course. I can't distinguish between the case with validation messages and the case without them, because I can't find the validation message in the source.

      Could anybody help me or suggest a different solution? I hope my description of the problem was clear enough.:)

      Thanks in advance,

      Balazs

        • 1. Re: problem with rich:message in IE
          daniel.soneira

          Here is our solution:

          First the error section that contains the error messages.
          Notice the rendered="..." part.
          -> If there are no errors there is no div "errorSection"

          <a4j:outputPanel ajaxRendered="true">
           <a4j:outputPanel id="errorSection" layout="block" rendered="${!empty facesContext.maximumSeverity}">
           <h:messages showSummary="false" showDetail="true" id="errors"/>
           </a4j:outputPanel>
          </a4j:outputPanel>
          


          ==> document.getElementById("errorSection") returns null.

          • 2. Re: problem with rich:message in IE
            balazs_hu

            Really thank you! Your solution helped me much, it works now!