So I had a need to inject a custom validation message for a required text
component when the field value is not present. No problem I said, looking at
some wiki pages and other online content, I found that it should be easily
added as any other i18n property:

..Required=My custom message.

However, debugging through the only keys the MessageSource seems to go
through are:
.Required
Required

So, debugging through I see that the MessageSource inner class of
FormComponent works by allowing the FormComponent to inject a prefix to the
key, which would then look for the following keys:
..Required
.Required
Required

So is the form Id no longer used?

Digging further I can see that the default implementation in FormComponent
to get a prefix is to ask the form for a validation prefix, which by turn
returns null. So even if I override this method in the Form to return the
form id, it's still only going to look through:
..Required
.Required
Required

So did the original property name I saw online ever work?
..Required=My custom message.

I'm on 1.4.2 (old I know), but nothing appears to have change in this arena
on 1.4.16 either.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Validation-messages-for-required-fields-using-form-id-tp3403212p3403212.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to