Validation messages for required fields using form id

2011-03-24 Thread mwilber
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



Re: Validation messages for required fields using form id

2011-03-24 Thread mwilber
Would it be true that the entire form id from the page level down is needed?

tabs.panel. for instance? That seems to work.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Validation-messages-for-required-fields-using-form-id-tp3403212p3403612.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



Re: Validation messages for required fields using form id

2011-03-24 Thread Martin Grigorov
On Thu, Mar 24, 2011 at 9:01 PM, mwilber matt.wil...@gmail.com wrote:

 Would it be true that the entire form id from the page level down is
 needed?

 tabs.panel. for instance? That seems to work.

 All of them should work.
More specific ones have bigger priority.


  --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Validation-messages-for-required-fields-using-form-id-tp3403212p3403612.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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/