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
Priority: Minor
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.
-
You can reply to this email to add a comment to the issue online.