we kind of have that support in AbstractValidator protected Map variablesMap(IValidatable validatable) { final Map resourceModel = new HashMap(1); return resourceModel; }
the problem is that somehow it should do a call back to the IValidatable (which is FormComponent most of the time) so that that will also fill in stuff.. protected Map variablesMap(IValidatable validatable) { final Map resourceModel = new HashMap(3); validatable.fillVariablesMap(resourceModel); return resourceModel; } then it will be very easy for people to do that. Igor what do you think? Those parts are mostly your code and i guess having a IModel inside the IValidator is not what you want :) johan On Tue, May 20, 2008 at 4:14 PM, Hoover, William <[EMAIL PROTECTED]> wrote: > > What does everyone think about updating the Wicket core validators to > contain an optional IModel? > > Simple Use Case: > # properties file > label.myminimum=My Object at row: {0} with value '${input}' must be > smaller than ${minimum} > > ... > final RefreshingView myView = new RefreshingView("tr-my-object-view") { > protected final void populateItem(final Item item) { > ... > final TextField myTextField = new > TextField("input-text-field"); > final IModel myMinValidatorModel = new > StringResourceModel("label.myminimum", item, null, new Object[] { > item.getIndex() }); > > myTextField.add(NumberValidator.MinimumValidator.minimum(10L, > myMinValidatorModel); > ... > } > }; > ... > > So, instead of seeing a very general message that could apply to any > number of fields that may contain the same value: > ... > '0' is smaller than the minimum of 10. > '0' is smaller than the minimum of 10. > '0' is smaller than the minimum of 10. > ... > > You would see this: > ... > My Object at row: 1 with value '0' must be smaller than 10 > My Object at row: 12 with value '0' must be smaller than 10 > My Object at row: 20 with value '0' must be smaller than 10 > ... > > The problem with just overriding the "NumberValidator.minimum" resource > in this example is that makes it difficult to add custom property values > (i.e. the index in example). > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >