voyent
Cannot modify default validator message.  XML
Forum Index -> Components
Author Message
maxi_ng

Joined: 11/Jan/2008 00:00:00
Messages: 92
Offline


faces-config.xml fragment
Code:
<application>
         <message-bundle>messages</message-bundle>
         <locale-config>
             <default-locale>en</default-locale>
             <supported-locale>en</supported-locale>
         </locale-config>
     </application>    


my message bundle
Code:
 javax.faces.component.UIInput.REQUIRED=This field is required
 javax.faces.validator.NOT_IN_RANGE=Value must be between 0~2147483647
 javax.faces.validator.DoubleRangeValidator.MAXIMUM=Value must be between 0~2147483647
 javax.faces.validator.LongRangeValidator.MAXIMUM=Value must be between 0~2147483647
 javax.faces.validator.DoubleRangeValidator.MINIMUM=Value must be between 0~2147483647
 javax.faces.validator.LongRangeValidator.MINIMUM=Value must be between 0~2147483647
 


.jspx fragment
Code:
 <ice:inputText id="eventNameTxt" disabled="#{EventBean.eventNameTxt}" value="#{EventBean.selectedEvent.name}" required="true"/>
                                 <ice:message for="eventNameTxt"/>
 
 <ice:inputText id="capacityTxt" disabled="#{EventBean.capacityTxt}" value="#{EventBean.selectedEvent.capacity}">
                                     <f:validateLongRange maximum="2147483647" minimum="0"/>
                                 </ice:inputText>
                                 <ice:message for="capacityTxt"/>
 


The first one works, message is shown as what I customize.
The second won't work, just show the default message.
Code:
_ManageEvent_WAR_EMS42ManageEvent_INSTANCE_j8ki_:EventForm:capacityTxt: '-' must be a number between -2147483648 and 2147483647 Example: 9346

What did I do wrong?

[Thumb - message.PNG]
 Filename message.PNG [Disk] Download
 Description
 Filesize 7 Kbytes
 Downloaded:  494 time(s)

Lari

Joined: 16/Feb/2008 00:00:00
Messages: 28
Offline


Ditto, we've noticed this also. Very frustrating.
maxi_ng

Joined: 11/Jan/2008 00:00:00
Messages: 92
Offline


my god, that means I didn't do anything wrong?
that means I have to wait for a fix?
I guess I have to make custom validations everywhere...
ggingras

Joined: 11/Jun/2008 00:00:00
Messages: 8
Offline


I have the same problem, did you fix it?
knehez

Joined: 03/Mar/2008 00:00:00
Messages: 5
Offline


I have the same problem, please help!!!
cdkoch

Joined: 08/Dec/2010 08:13:20
Messages: 6
Offline


I'm experiencing the same problem. My customer requiredMessage is working fine, but my customer validatorMessage is not overriding the default message.


Has anyone found a fix for this yet?
aortizg

Joined: 09/Aug/2010 12:17:55
Messages: 1
Offline


Have you tried overwriting javax.faces.converter.IntegerConverter.INTEGER and javax.faces.converter.IntegerConverter.INTEGER_detail??
w0lfshad3

Joined: 23/Feb/2010 00:00:00
Messages: 1
Offline


The solution is that you don't have:
Code:
<application>  
 <message-bundle>packages_path.bundle_name</message-bundle>  
 </application>

in your faces-config.xml
Check out the solution HERE

There's another way too, if you're not using message summary and detail
HERE

If you are using JSF 1.2, requiredMessage, converterMessage, validatorMessage attribute will help you to define customized error message for each field. 


EDIT:
Also mirror any properties you overwrite in all your supported locales. It seemed to do the trick for me when it was working for the BigInteger converter but not for Integer, because in my _en file i only had the BigDecimal overwritten, and it wasn't working for Integer even if my default locale (which had overwritten both) is not _en.
 
Forum Index -> Components
Go to:   
Powered by JForum 2.1.7ice © JForum Team