On 29-10-2008 at 14:37, Abhirama Bhat wrote:
> I am using custom validation. When there is an error and the error message
> is displayed is there a way to tell stripes on which field the focus should
> be?

First, I'm assuming you've created a method that is correctly called to
validate your input, and you can even log the validation result.

The problem you describe is to put the validation error somewhere Stripes can
pick it up. You'll want access to the ValidationErrors object to do this.

Documentation URL:
    http://www.stripesframework.org/display/stripes/Validation+Reference

As documented at the URL above (search for "ValidationErrors"), you can get
this object in two ways. For validation methods, I prefer the second:
@ValidationMethod public void validateSomething(ValidationErrors errors) { ... }

You can then add your error message like this:
    errors.add("fieldName" new LocalizableError("messageKey"));
or:
    errors.addGlobalError(new LocalizableError("messageKey"));

Note that this constructor has a varags argument Object... parameters to
specify parameters for the message.


Oscar

-- 
   ,-_
  /() )  QED - Quite Easily Done
 (__ (
=/  ()

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to