You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by MYoung <cl...@live.com> on 2008/02/19 23:54:01 UTC

How to find all error resourceKeys of a form field?

Hi, I'm learning wicket and I have a hard time determining the resourceKey of
a component.

In my code:

    	Form form = new Form("myForm") ....

    	TextField weight = new TextField("weight", Integer.class);
    	weight.setRequired(true);
    	weight.add(NumberValidator.minimum(0));
    	form.add(weight);


Since I call

    	weight.setRequired(true);
    	weight.add(NumberValidator.minimum(0));

I know I need at least the resourceKeys for these two cases.

By looking into the NumberValidator.java source, I can find the resourceKey
for 'minimum' is "myForm.weight.NumberValidator.minimum".  I know
setRequired corresponds to 'myForm.weight.Required' from other example.

But what about other resourceKey?  How do I find what they are?  For
example, entering 'xyz' will result in 'xyz' is not a valid Integer.  How to
find what this resourceKey is?

In general, what is the way to find out all possible error resourceKeys?
-- 
View this message in context: http://www.nabble.com/How-to-find-all-error-resourceKeys-of-a-form-field--tp15577859p15577859.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: How to find all error resourceKeys of a form field?

Posted by Igor Vaynberg <ig...@gmail.com>.
there is ConversionError.typename/ConversionName for type conversion
errors and IConverter.typename/IConverter for converter errors.

some of this is noted in formcomponent's javadoc.

-igor


On Feb 19, 2008 3:48 PM, MYoung <cl...@live.com> wrote:
>
> Ok, for the validators I added to the component, I can lookup the source.
> What about the TextField's data conversion error message?  Where to look
> that up?
>
>
>
> igor.vaynberg wrote:
> >
> > there is no way to find out what resource key the validator will check
> > other then read the javadoc where they should be specified. by default
> > we follow a convention that validator uses the resource key of its
> > class name
> >
> > so NumberValidator will use a resource key "NumberValidator"
> > StringValidator.minimum will use "StringValidator.minimum", etc
> >
> > -igor
> >
> >
> > On Feb 19, 2008 2:54 PM, MYoung <cl...@live.com> wrote:
> >>
> >> Hi, I'm learning wicket and I have a hard time determining the
> >> resourceKey of
> >> a component.
> >>
> >> In my code:
> >>
> >>         Form form = new Form("myForm") ....
> >>
> >>         TextField weight = new TextField("weight", Integer.class);
> >>         weight.setRequired(true);
> >>         weight.add(NumberValidator.minimum(0));
> >>         form.add(weight);
> >>
> >>
> >> Since I call
> >>
> >>         weight.setRequired(true);
> >>         weight.add(NumberValidator.minimum(0));
> >>
> >> I know I need at least the resourceKeys for these two cases.
> >>
> >> By looking into the NumberValidator.java source, I can find the
> >> resourceKey
> >> for 'minimum' is "myForm.weight.NumberValidator.minimum".  I know
> >> setRequired corresponds to 'myForm.weight.Required' from other example.
> >>
> >> But what about other resourceKey?  How do I find what they are?  For
> >> example, entering 'xyz' will result in 'xyz' is not a valid Integer.  How
> >> to
> >> find what this resourceKey is?
> >>
> >> In general, what is the way to find out all possible error resourceKeys?
> >> --
> >> View this message in context:
> >> http://www.nabble.com/How-to-find-all-error-resourceKeys-of-a-form-field--tp15577859p15577859.html
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/How-to-find-all-error-resourceKeys-of-a-form-field--tp15577859p15579102.html
>
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: How to find all error resourceKeys of a form field?

Posted by MYoung <cl...@live.com>.
Ok, for the validators I added to the component, I can lookup the source. 
What about the TextField's data conversion error message?  Where to look
that up?


igor.vaynberg wrote:
> 
> there is no way to find out what resource key the validator will check
> other then read the javadoc where they should be specified. by default
> we follow a convention that validator uses the resource key of its
> class name
> 
> so NumberValidator will use a resource key "NumberValidator"
> StringValidator.minimum will use "StringValidator.minimum", etc
> 
> -igor
> 
> 
> On Feb 19, 2008 2:54 PM, MYoung <cl...@live.com> wrote:
>>
>> Hi, I'm learning wicket and I have a hard time determining the
>> resourceKey of
>> a component.
>>
>> In my code:
>>
>>         Form form = new Form("myForm") ....
>>
>>         TextField weight = new TextField("weight", Integer.class);
>>         weight.setRequired(true);
>>         weight.add(NumberValidator.minimum(0));
>>         form.add(weight);
>>
>>
>> Since I call
>>
>>         weight.setRequired(true);
>>         weight.add(NumberValidator.minimum(0));
>>
>> I know I need at least the resourceKeys for these two cases.
>>
>> By looking into the NumberValidator.java source, I can find the
>> resourceKey
>> for 'minimum' is "myForm.weight.NumberValidator.minimum".  I know
>> setRequired corresponds to 'myForm.weight.Required' from other example.
>>
>> But what about other resourceKey?  How do I find what they are?  For
>> example, entering 'xyz' will result in 'xyz' is not a valid Integer.  How
>> to
>> find what this resourceKey is?
>>
>> In general, what is the way to find out all possible error resourceKeys?
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-find-all-error-resourceKeys-of-a-form-field--tp15577859p15577859.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-find-all-error-resourceKeys-of-a-form-field--tp15577859p15579102.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: How to find all error resourceKeys of a form field?

Posted by Igor Vaynberg <ig...@gmail.com>.
there is no way to find out what resource key the validator will check
other then read the javadoc where they should be specified. by default
we follow a convention that validator uses the resource key of its
class name

so NumberValidator will use a resource key "NumberValidator"
StringValidator.minimum will use "StringValidator.minimum", etc

-igor


On Feb 19, 2008 2:54 PM, MYoung <cl...@live.com> wrote:
>
> Hi, I'm learning wicket and I have a hard time determining the resourceKey of
> a component.
>
> In my code:
>
>         Form form = new Form("myForm") ....
>
>         TextField weight = new TextField("weight", Integer.class);
>         weight.setRequired(true);
>         weight.add(NumberValidator.minimum(0));
>         form.add(weight);
>
>
> Since I call
>
>         weight.setRequired(true);
>         weight.add(NumberValidator.minimum(0));
>
> I know I need at least the resourceKeys for these two cases.
>
> By looking into the NumberValidator.java source, I can find the resourceKey
> for 'minimum' is "myForm.weight.NumberValidator.minimum".  I know
> setRequired corresponds to 'myForm.weight.Required' from other example.
>
> But what about other resourceKey?  How do I find what they are?  For
> example, entering 'xyz' will result in 'xyz' is not a valid Integer.  How to
> find what this resourceKey is?
>
> In general, what is the way to find out all possible error resourceKeys?
> --
> View this message in context: http://www.nabble.com/How-to-find-all-error-resourceKeys-of-a-form-field--tp15577859p15577859.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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