[jboss-user] [JBoss Seam] - Re: Validation: @NotNull required=true
As of JSF 1.2, the h:inputText control has requiredMessage attribute that you can customize for each input field's required error message. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4120709#4120709 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4120709 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Validation: @NotNull required=true
I think thisis what you are after: | javax.faces.component.UIInput.CONVERSIONConversion error occurred | javax.faces.component.UIInput.REQUIRED required | javax.faces.component.UISelectOne.INVALID Value is not a a valid option | javax.faces.component.UISelectMany.INVALID Value is not a valid option | javax.faces.validator.NOT_IN_RANGE Specified attribute is not between the expected values of {0} and {1} | javax.faces.validator.DoubleRangeValidator.MAXIMUM Value is greater than allowable maximum of '{0}' | javax.faces.validator.DoubleRangeValidator.MINIMUM Value is less than allowable minimum of '{0}' | javax.faces.validator.DoubleRangeValidator.TYPE Value is not of the correct type | javax.faces.validator.LengthValidator.MAXIMUM Value is greater than allowable maximum of '{0}' | javax.faces.validator.LengthValidator.MINIMUM Value is less than allowable minimum of '{0}' | javax.faces.validator.LongRangeValidator.MAXIMUMValue is greater than allowable maximum of '{0}' | javax.faces.validator.LongRangeValidator.MINIMUMValue is less than allowable minimum of '{0}' | javax.faces.validator.LongRangeValidator.TYPE Value is not of the correct type | | put into a file in my War Src area. I refer to it in my faces.config | !-- My Messages Please -- | application | message-bundlenz.co.risingstars.i18n.jsfstandarderrors/message-bundle | /application | This is on top of the messages you put into the messages.properies in the jar. (there are a LOT more message that just this list!): | javax.faces.component.UIInput.CONVERSION error | javax.faces.component.UIInput.CONVERSION_detail = invalid | javax.faces.component.UIInput.REQUIRED required | javax.faces.convert.DateTimeConverter.CONVERSION = must be a valid date | #javax.faces.convert.DateTimeConverter.CONVERSION_detail = value must be a datetime | | #javax.faces.component.UISelectOne.INVALID Value is not a a valid option | #javax.faces.component.UISelectMany.INVALID Value is not a valid option | #javax.faces.validator.NOT_IN_RANGE Specified attribute is not between the expected values of {0} and {1} | #javax.faces.validator.DoubleRangeValidator.MAXIMUM Value is greater than allowable maximum of '{0}' | #javax.faces.validator.DoubleRangeValidator.MINIMUM Value is less than allowable minimum of '{0}' | #javax.faces.validator.DoubleRangeValidator.TYPE Value is not of the correct type | #javax.faces.validator.LengthValidator.MAXIMUM Value is greater than allowable maximum of '{0}' | #javax.faces.validator.LengthValidator.MINIMUM Value is less than allowable minimum of '{0}' | #javax.faces.validator.LongRangeValidator.MAXIMUMValue is greater than allowable maximum of '{0}' | #javax.faces.validator.LongRangeValidator.MINIMUMValue is less than allowable minimum of '{0}' | #javax.faces.validator.LongRangeValidator.TYPE Value is not of the correct type | | #javax.faces.convert.DateTimeConverter.CONVERSION= Conversion Error | #javax.faces.convert.DateTimeConverter.CONVERSION_detail = {1}: xxSpecified value is not a valid date/time. | #javax.faces.converter.DateTimeConverter.DATE=value must be a date | #javax.faces.converter.DateTimeConverter.DATE_detail=value must be a date, eg. {1} | #javax.faces.converter.DateTimeConverter.TIME=value must be a time | #javax.faces.converter.DateTimeConverter.TIME_detail=value must be a time, eg. {1} | #javax.faces.converter.DateTimeConverter.DATETIME=value must be a date and time | #javax.faces.converter.DateTimeConverter.DATETIME_detail=value must be a date and time, eg. {1} | #javax.faces.converter.DateTimeConverter.PATTERN_TYPE=a pattern or type attribute must be specified to convert the value | #JSF 1.1: | #javax.faces.convert.BigDecimalConverter.CONVERSION = value must be a number | #javax.faces.convert.BigDecimalConverter.CONVERSION_detail = value must be a number | #javax.faces.convert.BigIntegerConverter.CONVERSION = value must be an integre | #javax.faces.convert.BigIntegerConverter.CONVERSION_detail = value must be a number | #javax.faces.convert.BooleanConverter.CONVERSION = value must be true or false | #javax.faces.convert.BooleanConverter.CONVERSION_detail = value must be true or false | #javax.faces.convert.ByteConverter.CONVERSION = value must be a byte | #javax.faces.convert.ByteConverter.CONVERSION_detail = value must be a byte | #javax.faces.convert.CharacterConverter.CONVERSION = value must be a character | #javax.faces.convert.CharacterConverter.CONVERSION_detail = value must be a character | #javax.faces.convert.DoubleConverter.CONVERSION = value must be a number | #javax.faces.convert.DoubleConverter.CONVERSION_detail = value must be a number | javax.faces.convert.FloatConverter.CONVERSION = value must be a number | javax.faces.convert.FloatConverter.CONVERSION_detail = value must be a number |
[jboss-user] [JBoss Seam] - Re: Validation: @NotNull required=true
If this is helpful then you might want to propose to add it to the FAQ... View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045188#4045188 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045188 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Validation: @NotNull required=true
Thanks for reply, but I don't know how to disable the displaying the UIInput default validation message. When the field isn't empty, the hibernate validation work good. If the input is empty the UIInput default message is show - and I would like to don't show this but show the @NotNull. M. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045189#4045189 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045189 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Validation: @NotNull required=true
Currently there is no way to utilize the message of @NotNull, you need to change the JSF validator message for required=true globally. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045193#4045193 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045193 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Validation: @NotNull required=true
There is no way to do it globally but you can use a phase listener: import java.util.Iterator; | | import javax.faces.application.FacesMessage; | import javax.faces.component.UIComponent; | import javax.faces.component.UIViewRoot; | import javax.faces.context.FacesContext; | import javax.faces.event.PhaseEvent; | import javax.faces.event.PhaseId; | import javax.faces.event.PhaseListener; | | /** | * Example messages.properties entries: | * javax.faces.validator.LengthValidator.MAXIMUM=[fieldLabel] value is greater than allowable maximum of {0} characters. | * javax.faces.validator.LengthValidator.MINIMUM=[fieldLabel] value must contain at least {0} characters. | */ | | @SuppressWarnings(serial) | public class MessageListener implements PhaseListener { | | public PhaseId getPhaseId() { | return PhaseId.RENDER_RESPONSE; | } | | public void beforePhase(PhaseEvent e) { | FacesContext fc = e.getFacesContext(); | UIViewRoot root = fc.getViewRoot(); | Iterator i = fc.getClientIdsWithMessages(); | while (i.hasNext()) { | String clientId = (String) i.next(); | if(clientId != null) { | UIComponent c = root.findComponent(clientId); | if (c != null) { | String fieldRef = | (String) c.getAttributes().get(fieldLabel); | if (fieldRef != null) { | Iterator j = fc.getMessages(clientId); | while (j.hasNext()) { | FacesMessage fm = (FacesMessage) j.next(); | String s = fm.getSummary(); | s = s.replaceFirst(\\[fieldLabel\\], fieldRef); | fm.setSummary(s); | } | } | } | } | } | } | | public void afterPhase(PhaseEvent e) { | } | } | Then specify the fielLabel in the f:attribute tag: h:inputText value=#{contactUs.email} size=50 maxlength=75 required=true | f:attribute name=fieldLabel value=Email/ | /h:inputText Or, if you require completely different messages for each component, you could specify a resource bundle key h:inputText value=#{contactUs.email} size=50 maxlength=75 required=true | f:attribute name=bundleKey value=contactus.error.email.required/ | /h:inputText Using the latter approach, you would get the resource bundle key from the component attributes map in the listener and replace the summary text altogether. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045194#4045194 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045194 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Validation: @NotNull required=true
On second thought, this is of no use to you within the context of hibernate validation. This is strictly JSF. I'll be quiet now. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045195#4045195 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045195 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user