[
https://issues.apache.org/jira/browse/WICKET-1654?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Igor Vaynberg resolved WICKET-1654.
-----------------------------------
Resolution: Fixed
Fix Version/s: 6.0.0
in 6.0 validators provide a decorate() method that can be used to construct
validation error in a different way
> Update validators to accept IModel parameter for easy override of error
> messages
> --------------------------------------------------------------------------------
>
> Key: WICKET-1654
> URL: https://issues.apache.org/jira/browse/WICKET-1654
> Project: Wicket
> Issue Type: Improvement
> Components: wicket
> Affects Versions: 1.4-M1
> Environment: N/A
> Reporter: Will Hoover
> Assignee: Igor Vaynberg
> Priority: Minor
> Fix For: 6.0.0
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Update validators to accept IModel parameter for easy override of error
> messages. Instead of looking up the resource key in "Application.properties"
> and adding to the components properties file, allow a model to be passed into
> the validators that will override the default validation error message. For
> example:
> StringResourceModel srm = new
> StringResourceModel("my.custom.stringvalidator.message", null);
> add(new TextField("fname").setLabel(new Model("first
> name")).add(StringValidator.minimum(5, srm));
> 1) This will also allow someone to pass in parameters that they want
> displayed along with the validation error message (difficult to accomplish
> when just overriding the resource key- where to pass?)
> 2) More intuitive because it uses the same concept that is applied to
> components... i.e. new TextField("id", new Model(...)) VS
> StringValidator.minimum(5, new Model(...))
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira