You can use page or component scoped messages. On Thu, Dec 16, 2010 at 11:48 AM, Matthias Keller <matthias.kel...@ergon.ch> wrote: > Hi > > This is an issue I frequently run into and I haven't found a good solution > yet: > I've got a Form using a CompoundPropertyModel and having lots of fields. > The easy way to do these fields is: > form.add(new RequiredTextField<String>("name")); > > The model object has a getter and setter for name, so all works well. > Unfortunately, when the user doesn't enter a valid value, the Required error > message shows up saying something like "Field 'name' is required". > I could have a resource key "name" in my translations but this has the > limitation, that all "name" fields in my whole app are translated the same > way. Maybe one name is a human name, the other one is a machine name which > have different translations... > Is there an easy way to tackle this problem? For example have a prefix > prepended to the field name or something else? One thing I want to avoid is > to set an explicit label model for every field and if possible I'm hoping to > avoid having to create different TextField subclasses for all my pages just > prepending that string.... > > How do you do this for large applications? > Currently, we're reverting to > form.add(new RequiredTextField<String>("somepage.name", new > PropertyModel<String>(model, "name"))); > which kinda defeats the whole CompoundPropertyModel stuff.... > > Thanks a lot > > Matt > >
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org