10 Replies Latest reply on Jan 30, 2009 8:03 AM by ramki9977

    Required field validation

      hi,
      in my app i have a form with 2 textboxes(required=true). when i enter spaces into those text boxes and click on save its not showing any error messages. but when ever user enters spaces into text boxes, i need to show required message. how can i do that.

      thanks,
      ramki.

        • 1. Re: Required field validation
          nbelaevski

          Hi,

          Create your own converter that will trim string and use it with the component.

          • 2. Re: Required field validation

            hi,
            thanks for reply. i created my own converter to trim the strings. and i have one more requirement in my app. when ever the required message thrown it will display beside the text box or other component. but i want a error icon to display beside that text box and when ever i move mouse i need to show error message. can you please help me how to do this.

            thanks,
            ramki.

            • 3. Re: Required field validation
              nbelaevski

               

              "ramki9977" wrote:
              hi,
              thanks for reply. i created my own converter to trim the strings. and i have one more requirement in my app. when ever the required message thrown it will display beside the text box or other component. but i want a error icon to display beside that text box and when ever i move mouse i need to show error message. can you please help me how to do this.

              thanks,
              ramki.
              Can you please post screenshot somewhere to help e understand what's necessary?

              • 4. Re: Required field validation
                ilya_shaikovsky

                Next code should works for you. There when we getting error only red marker occurs. And after you over this marker - tooltip shown with the error text.

                <h:form id="form">
                 <h:outputText value="Name:" />
                 <h:inputText label="Name" id="name" required="true" value="#{userBean.name}">
                 <f:validateLength minimum="3" />
                 </h:inputText>
                 <a4j:outputPanel id="message">
                 <rich:message for="name" showDetail="false" showSummary="false">
                 <f:facet name="errorMarker">
                 <h:graphicImage value="/images/ajax/error.gif" />
                 </f:facet>
                 </rich:message>
                 <rich:toolTip attached="true">
                 <h:outputText value="Error:"/>
                 <rich:message for="name" showDetail="true" showSummary="true"/>
                 </rich:toolTip>
                 </a4j:outputPanel>
                 <a4j:commandButton value="Validate" reRender="message"/>
                 </h:form>


                • 5. Re: Required field validation

                  hi,
                  its looking good but its little lengthy in coding. any we have one <rich:message/> is there any option in that tag to show this error message through error icon. may be it would be good if we have that option in <rich:message/>. please comment on this feature.

                  thanks,
                  ramki.

                  • 6. Re: Required field validation
                    gopib

                    Hi

                    U have to keep the requiredMessage (requiredMessage="Please Enter Name") attribute in <h:inputText>

                    • 7. Re: Required field validation
                      ilya_shaikovsky

                      seems not bad feature.. but the case already could be implemented and we are mainly targeted to the features which still can't be done by the components composition and so on.. Seems like such features more preferable for future implementation :)

                      • 8. Re: Required field validation

                        so we can expect this feature in coming versions.

                        • 9. Re: Required field validation
                          ilya_shaikovsky

                          I've tried to tell you just opposite thing :) you could rise the RFC in our jira.. but as this feature already has implementation via components composition it will not be near future versioned.

                          • 10. Re: Required field validation

                            ok thanks for reply