Yes, I overriden the message with the default English one and it works. But...to translate the message into Chinese in a better way, the order of the 2 parameters has to be reversed. Is there anyway to handle this situation?

于 2012/3/8 18:39, Lance Java 写道:
Try overriding the error message using these instructions:

http://tapestry.apache.org/forms-and-validation.html#FormsandValidation-CustomizingValidationMessages

Set the error message to something like "no more than %d chars allowed in
%s"

On Thursday, 8 March 2012, Lance Java<lance.j...@googlemail.com>  wrote:
What language are your error messages displaying in?

Perhaps there is a bad format in one of the language property files.

FYI, the validator is looking for a property named "maximum-string-length"

On Thursday, 8 March 2012, Lance Java<lance.j...@googlemail.com>  wrote:
Have you overridden the validation error message?

Tapestry is having troubles showing an error message and is trying to
push a string where an integer should go.
Somewhere in the validation error message, there is a %d where it should
be a %s.
On Thursday, 8 March 2012, Rural Hunter<ruralhun...@gmail.com>  wrote:
I just meet a strange error with MaxLength Validator with tapestry
5.3.1. My test page is vary simple(copied from jump start):
Page:
<form t:type="form" t:id="inputs">
<t:errors/>
<table>
<tr>
<td>aaa:</td>
<td><input t:type="TextField" t:id="firstName"
t:validate="maxlength=5"/></td>
<td>(required, maxLength=10, letters only)</td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Display"/></td>
<td></td>
</tr>
</table>
</form>

Then the page run with error:
CreatingValidators1:firstname (class
org.apache.tapestry5.corelib.components.TextField)
context:CreatingValidators1.tml, line 17
12<form t:type="form" t:id="inputs">
13<t:errors/>
14<table>
15<tr>
16<td>aaa:</td>
17<td><input t:type="TextField" t:id="firstName"
t:validate="maxlength=5"/></td>
18<td>(required, maxLength=10, letters only)</td>
19</tr>
20<tr>
21<td></td>
22<td><input type="submit" value="Display"/></td>

org.apache.tapestry5.ioc.internal.util.TapestryException
d != java.lang.String

location
    context:CreatingValidators1.tml, line 17

java.util.IllegalFormatConversionException
d != java.lang.String

argumentClass
    class java.lang.String
conversion
    d
Filter stack frames Stack trace


  java.util.Formatter$FormatSpecifier.failConversion(Formatter.java:3999)
  java.util.Formatter$FormatSpecifier.printInteger(Formatter.java:2709)
        java.util.Formatter$FormatSpecifier.print(Formatter.java:2661)
        java.util.Formatter.format(Formatter.java:2433)
        java.util.Formatter.format(Formatter.java:2367)
        java.lang.String.format(String.java:2813)

  
org.apache.tapestry5.ioc.internal.util.MessageFormatterImpl.format(MessageFormatterImpl.java:49)
  org.apache.tapestry5.validator.MaxLength.buildMessage(MaxLength.java:39)
  org.apache.tapestry5.validator.MaxLength.render(MaxLength.java:48)
  org.apache.tapestry5.validator.MaxLength.render(MaxLength.java:23)
  
org.apache.tapestry5.internal.services.FieldValidatorImpl.render(FieldValidatorImpl.java:56)
  
org.apache.tapestry5.internal.services.CompositeFieldValidator.render(CompositeFieldValidator.java:45)
  
org.apache.tapestry5.corelib.base.AbstractTextField.begin(AbstractTextField.java:167)
  
org.apache.tapestry5.corelib.base.AbstractTextField.beginRender(AbstractTextField.java)
I don't understand what happened internally. The same code works fine
with tapestry 5.2.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to