On 15/01/2010 04:29 AM, getagrip wrote:
There is also no documentation on email-validation-keys in
http://incubator.apache.org/click/docs/user-guide/html/ch03s04.html#control-properties
The above link lists all the validation keys in click-core. EmailField is part of click-extras. You
can find its keys in the JavaDoc:
http://incubator.apache.org/click/docs/extras-api/org/apache/click/extras/control/EmailField.html#validate()
I think the key you are after is: email-format-error
kind regards
bob
Any hints?
Regards, getagrip
Bob Schellink wrote:
Hi,
I haven't tried it but I believe what you can do is override the default
validation messages in your click-page.properties files using the
following convention:
<fieldname>.<validation-key>
eg:
username.field-required-error=Enter a value or else!
where "validation-key" must be the key the field will use for its
specific validation.
The validation keys for click-core are summarized here:
http://incubator.apache.org/click/docs/user-guide/html/ch03s04.html#control-properties
You can even copy the click-control.properties file to your src root
folder and change the default validation messages.
You'll also find the validation keys for controls specified inside their
JavaDoc #validate methods.
Hope this helps.
kind regards
bob
On 14/01/2010 01:47 PM, getagrip wrote:
What I'm looking for is how to setup the functionality so that the
framework uses my "click-page_en.properties file".
If a form-element named "username" yields an error I would like to have
the framework assign the value of "username_error" to the field.
Is this possible?
Regards, getagrip
getagrip wrote:
Hi,
is it possible to add custom validation error-messages to single field
objects upon validation?
Of course I can pick every single field and add a message to it by hand,
but considering dozens of fields per form this would be a very
tedious job.
I need to do server-side validation and I have the form's FieldList:
List<Field> fieldlist = form.getFieldList();
for(Field field : fieldlist) {
// the field's error-property has been set before by the framework...
if(! "".equals(field.getError())) {
// Every form-element needs to have a custom error-message so here
// is my problem: I do not want to perform a huge if-else
// orgy here by checking all possible form-element-names so is
there
// another way?
}
}
I guest it might be possible to have this done automatically via
messagebundles.
The docs say:
"Field classes support a hierarchy of resource bundles for displaying
validation error messages and display messages. These localized messages
can be accessed through the Field methods".
Are there any examples out there that demonstrate this behaviour?
Regards, getagrip