3 Replies Latest reply on Dec 8, 2007 3:47 AM by thiagu.m

    how to prevent the form submit when we click on rich:suggest

      Hai every one

      in my page i use rich:suggestionbox and inputText fields.
      i validate the fields at the time of form submit.
      if i click on the rich:suggestionbox, i get the validation error message for all other fields.

      how to resolve this problem
      please any one help me

      By
      Thiagu.m

        • 1. Re: how to prevent the form submit when we click on rich:sug
          ilya_shaikovsky

          use ajaxSingle="true" on SB component,

          • 2. Re: how to prevent the form submit when we click on rich:sug

            Thank you for your replay

            Actually i am using that rich:suggestionbox on the rich:modalPanel with some other field.
            I need prevent modal panel from closure if the validation inside fails.
            This is my code

            <h:inputText id=�name� value="#{bean.name}" required="true"/>
             <a4j:outputPanel ajaxRendered="true">
             <h:message id="error" for=�name�/>
             </a4j:outputPanel>
             <h:inputText id=�country� value="#{bean.country }" required="true"/>
            <rich:suggestionbox id="sugBox" for="country" tokens=",["
             rules="#{suggestionBox.rules}"
             suggestionAction="#{suggestionBox.autocomplete}" var="result"
             fetchValue="#{result.text}" >
             <h:column>
             <h:outputText value="#{result.text}" />
             </h:column>
             </rich:suggestionbox>
             <a4j:outputPanel ajaxRendered="true">
             <h:message id="error1" for=�country�/>
             </a4j:outputPanel>
            
            
             <a4j:commandLink value="click" oncomplete="windowclose();" reRender="test" />
            
             </h:form>
            </rich:modalPanel>
            
            <script type="text/javascript">
            function windowclose()
            {
            if (document.getElementById('mpform:error')==null)
            if (document.getElementById('mpform:error1')==null)
            {
            Richfaces.hideModalPanel('_panel');
            };
            };
            </script>
            


            so when i click on suggestionbox it always shows the validation errors

            any one help me
            By
            Thiagu.m

            • 3. Re: how to prevent the form submit when we click on rich:sug

              Thank you for your replay

              Actually i am using that rich:suggestionbox on the rich:modalPanel with some other field.
              I need prevent modal panel from closure if the validation inside fails.
              This is my code

              <a href="javascript:Richfaces.showModalPanel('_panel',{left:'auto', top:'auto'})">
              Show Modal Panel</a>
              
               <rich:modalPanel id="_panel">
               <f:facet name="header">
               <h:outputText value="test"/>
               </f:facet>
               <h:form id="mpform">
              
               <h:inputText id=�name� value="#{bean.name}" required="true"/>
               <a4j:outputPanel ajaxRendered="true">
               <h:message id="error" for=�name�/>
               </a4j:outputPanel>
               <h:inputText id=�country� value="#{bean.country }" required="true"/>
              <rich:suggestionbox id="sugBox" ajaxSingle="true" for="country" tokens=",["
               rules="#{suggestionBox.rules}"
               suggestionAction="#{suggestionBox.autocomplete}" var="result"
               fetchValue="#{result.text}" >
               <h:column>
               <h:outputText value="#{result.text}" />
               </h:column>
               </rich:suggestionbox>
               <a4j:outputPanel ajaxRendered="true">
               <h:message id="error1" for=�country�/>
               </a4j:outputPanel>
              
              
               <a4j:commandLink value="click" oncomplete="windowclose();" reRender="test" />
              
               </h:form>
              </rich:modalPanel>
              
              <script type="text/javascript">
              function windowclose()
              {
              if (document.getElementById('mpform:error')==null)
              if (document.getElementById('mpform:error1')==null)
              {
              Richfaces.hideModalPanel('_panel');
              };
              };
              </script>


              so when i click on suggestionbox it always shows the validation errors

              any one help me
              By
              Thiagu.m