You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "spencer.c" <sp...@gmail.com> on 2007/09/05 18:14:27 UTC

Wicket Validation Error

I'm having a little problem with validation, and would like an extra pair of
eyes.

I have a form that gets validated, with a custom message defined in the
class properties file.

In Share.java:
   ...
   add( new SendFileForm("sendForm"));
   ...
   class SendFileForm extends Form {
      ...
      TextField senderField = new TextField("senderField");
      senderField.add(StringValidator.maximumLength(254));
      senderField.setRequired(true);
      add(senderField);
   ...

In Share.properties:
StringValidator.maximum=${label} must be no longer than ${maximum}
characters.
sendForm.senderField.Required=You must provide your email address to
proceed.


When I run as above, this works fine.  No problems, custom messages show up,
and all is well.

However, if in my Application class, I add the following line during init():
getResourceSettings().setUseDefaultOnMissingResource(false);

Suddenly, I get exceptions that the error messages are not found, ala:
ERROR - RequestCycle               - Exception
'java.util.MissingResourceException: Unable to find resource:
senderField.StringValidator.maximum for component: sendForm



Any ideas as to why this would happen?  I wanted to be as strict as possible
with my error handling, but setting that flag causes all my validation to
throw exceptions.  Where am I going wrong?

Thanks for insight,

Spencer
-- 
View this message in context: http://www.nabble.com/Wicket-Validation-Error-tf4386270.html#a12504756
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket Validation Error

Posted by Kent Tong <ke...@cpttm.org.mo>.


spencer.c wrote:
> 
> StringValidator.maximum=${label} must be no longer than ${maximum}
> characters.
> sendForm.senderField.Required=You must provide your email address to
> proceed.
> 

Try:
sendForm.senderField.StringValidator.maximum=${label} must be no longer than
${maximum} characters.
sendForm.senderField.Required=You must provide your email address to
proceed.

-- 
View this message in context: http://www.nabble.com/Wicket-Validation-Error-tf4386270.html#a12576183
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org