user2061913
user2061913

Reputation: 920

Disable validation errors from showing to users Webpage

i have a webpage with some validation, and when the users enters in a wrong user name it tells them through ajax primefaces growl, this is working fine however in red at the top right of the form the error message appears as well, not in ajax, is there any way to stop this ?

here is the image

http://i1081.photobucket.com/albums/j348/west-wot/errror_zpsda7f29d7.jpg

it probs shows what i mean a lot better than my explaining, the error is not an error in the code just a validation error

added an image so you can see what the errors i mean, the ajax to the left is fine it is just the right hand side error messages i would like to hide

the code is

       <ui:define name="body">
        <!--<h:panelGroup id="messagePanel" layout="block">
                  <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
              </h:panelGroup> -->
        <h:form>
            <p:growl id="growl" showDetail="true" sticky="true" />
            <!--ajax messages working now -->

            <p:panel header="Enter details">
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.CreateUserdetailsLabel_id}"
                        for="id" />
                    <h:inputText id="id"
                        value="#{userdetailsController.selected.id}"
                        title="#{bundle.CreateUserdetailsTitle_id}" required="true"
                        requiredMessage="#{bundle.CreateUserdetailsRequiredMessage_id}" />
                    <h:outputLabel value="#{bundle.CreateUserdetailsLabel_username}"
                        for="username" />

                    <h:inputText id="UserName"
                        value="#{userdetailsController.selected.username}"
                        title="#{bundle.CreateUserdetailsTitle_username}"
                        required="true" requiredMessage="Username is required"
                        label="UserName">
                        <f:validator validatorId="richard.validator.UserNameValidator" />
                    </h:inputText>

                </h:panelGrid>
                <br />
                <h:commandLink action="#{userdetailsController.create}"
                    value="#{bundle.CreateUserdetailsSaveLink}" />
                <br />
                <br />
                <h:commandLink action="#{userdetailsController.prepareList}"
                    value="#{bundle.CreateUserdetailsShowAllLink}" immediate="true" />
                <br />
                <br />
                <h:link outcome="/index"
                    value="#{bundle.CreateUserdetailsIndexLink}" />
            </p:panel>

as you can see from the above code the error messages is commented out so should not effect things

Upvotes: 1

Views: 71

Answers (1)

LucasP
LucasP

Reputation: 1715

Try adding "globalOnly=true" to your growl.

<p:growl id="growl" showDetail="true" sticky="true" globalOnly="true" />

stackoverflow.com/a/15599070/2755755

Upvotes: 1

Related Questions