You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alex Objelean <al...@isdc.ro> on 2007/09/06 09:42:11 UTC
Wicket validation flaw?
I've discovered the following issue:
When using a DateTextField in a form (with the format: dd/MM/yyyy), user by
mistake add an extra space (for instance: "06/09/2007 ") and submit the
form. The are two problems:
1) I would expect the convertor to convert this value correct, but the
AbstractConverter.parse method throws a ConversionException because:
(position.getIndex() != stringValue.length())
2) The above exception is not reported anywhere, because validate method
does not check if the input is valid after converting its value:
> public final void validate()
> {
> validateRequired();
> if (isValid())
> {
> convertInput();
>
> if (isValid() && isRequired() && getConvertedInput() == null &&
> isInputNullable())
> {
> reportRequiredError();
> }
> /*isn't something like this missing here?*/ if
> (!isValid()) { /*report Conversion error*/ }
> if (isValid())
> {
> validateValidators();
> }
> }
> }
>
Any thoughts?
Thank you!
Alex.
--
View this message in context: http://www.nabble.com/Wicket-validation-flaw--tf4390183.html#a12517215
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: Wicket validation flaw?
Posted by Alex Objelean <al...@isdc.ro>.
I'm using datetextfield from the wicket-extensions.
Alex.
igor.vaynberg wrote:
>
> actually we do trim them.
>
> convertinput() calls convertvalue() which does trim. so if you override
> convertvalue() itself you need to trim yourself. however i do not see it
> being overwritten anywhere. is this datetextfield from extensions or
> wicket-datetime?
>
> -igor
>
>
> On 9/6/07, Matej Knopp <ma...@gmail.com> wrote:
>>
>> I thought we were trimming textfield strings, but now i see it's no
>> longer the case. Is it a regression or a feature?
>>
>> Also the missing message doesn't make much sense, can you please
>> report a JIRA issue and attach a quick start project?
>>
>> -Matej
>>
>> On 9/6/07, Alex Objelean <al...@isdc.ro> wrote:
>> >
>> > I've discovered the following issue:
>> > When using a DateTextField in a form (with the format: dd/MM/yyyy),
>> user
>> by
>> > mistake add an extra space (for instance: "06/09/2007 ") and submit the
>> > form. The are two problems:
>> >
>> > 1) I would expect the convertor to convert this value correct, but the
>> > AbstractConverter.parse method throws a ConversionException because:
>> > (position.getIndex() != stringValue.length())
>> >
>> > 2) The above exception is not reported anywhere, because validate
>> method
>> > does not check if the input is valid after converting its value:
>> >
>> >
>> >
>> > > public final void validate()
>> > > {
>> > > validateRequired();
>> > > if (isValid())
>> > > {
>> > > convertInput();
>> > >
>> > > if (isValid() && isRequired() &&
>> getConvertedInput() == null &&
>> > > isInputNullable())
>> > > {
>> > > reportRequiredError();
>> > > }
>> > > /*isn't something like this missing here?*/
>> if
>> > > (!isValid()) { /*report Conversion error*/ }
>> > > if (isValid())
>> > > {
>> > > validateValidators();
>> > > }
>> > > }
>> > > }
>> > >
>> >
>> > Any thoughts?
>> >
>> > Thank you!
>> > Alex.
>> > --
>> > View this message in context:
>> http://www.nabble.com/Wicket-validation-flaw--tf4390183.html#a12517215
>> > 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/Wicket-validation-flaw--tf4390183.html#a12536802
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: Wicket validation flaw?
Posted by Johan Compagner <jc...@gmail.com>.
convertvalue() isn't called for a datefield i think...
because i think the type is set (to Date) and then the converter is called:
convertedInput = converter.convertToObject(getInput(), getLocale());
so i don't think it will be trimmed...
johan
On 9/7/07, Igor Vaynberg <ig...@gmail.com> wrote:
>
> actually we do trim them.
>
> convertinput() calls convertvalue() which does trim. so if you override
> convertvalue() itself you need to trim yourself. however i do not see it
> being overwritten anywhere. is this datetextfield from extensions or
> wicket-datetime?
>
> -igor
>
>
> On 9/6/07, Matej Knopp <ma...@gmail.com> wrote:
> >
> > I thought we were trimming textfield strings, but now i see it's no
> > longer the case. Is it a regression or a feature?
> >
> > Also the missing message doesn't make much sense, can you please
> > report a JIRA issue and attach a quick start project?
> >
> > -Matej
> >
> > On 9/6/07, Alex Objelean <al...@isdc.ro> wrote:
> > >
> > > I've discovered the following issue:
> > > When using a DateTextField in a form (with the format: dd/MM/yyyy),
> user
> > by
> > > mistake add an extra space (for instance: "06/09/2007 ") and submit
> the
> > > form. The are two problems:
> > >
> > > 1) I would expect the convertor to convert this value correct, but the
> > > AbstractConverter.parse method throws a ConversionException because:
> > > (position.getIndex() != stringValue.length())
> > >
> > > 2) The above exception is not reported anywhere, because validate
> method
> > > does not check if the input is valid after converting its value:
> > >
> > >
> > >
> > > > public final void validate()
> > > > {
> > > > validateRequired();
> > > > if (isValid())
> > > > {
> > > > convertInput();
> > > >
> > > > if (isValid() && isRequired() &&
> > getConvertedInput() == null &&
> > > > isInputNullable())
> > > > {
> > > > reportRequiredError();
> > > > }
> > > > /*isn't something like this missing here?*/
> if
> > > > (!isValid()) { /*report Conversion error*/ }
> > > > if (isValid())
> > > > {
> > > > validateValidators();
> > > > }
> > > > }
> > > > }
> > > >
> > >
> > > Any thoughts?
> > >
> > > Thank you!
> > > Alex.
> > > --
> > > View this message in context:
> > http://www.nabble.com/Wicket-validation-flaw--tf4390183.html#a12517215
> > > 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: Wicket validation flaw?
Posted by Igor Vaynberg <ig...@gmail.com>.
actually we do trim them.
convertinput() calls convertvalue() which does trim. so if you override
convertvalue() itself you need to trim yourself. however i do not see it
being overwritten anywhere. is this datetextfield from extensions or
wicket-datetime?
-igor
On 9/6/07, Matej Knopp <ma...@gmail.com> wrote:
>
> I thought we were trimming textfield strings, but now i see it's no
> longer the case. Is it a regression or a feature?
>
> Also the missing message doesn't make much sense, can you please
> report a JIRA issue and attach a quick start project?
>
> -Matej
>
> On 9/6/07, Alex Objelean <al...@isdc.ro> wrote:
> >
> > I've discovered the following issue:
> > When using a DateTextField in a form (with the format: dd/MM/yyyy), user
> by
> > mistake add an extra space (for instance: "06/09/2007 ") and submit the
> > form. The are two problems:
> >
> > 1) I would expect the convertor to convert this value correct, but the
> > AbstractConverter.parse method throws a ConversionException because:
> > (position.getIndex() != stringValue.length())
> >
> > 2) The above exception is not reported anywhere, because validate method
> > does not check if the input is valid after converting its value:
> >
> >
> >
> > > public final void validate()
> > > {
> > > validateRequired();
> > > if (isValid())
> > > {
> > > convertInput();
> > >
> > > if (isValid() && isRequired() &&
> getConvertedInput() == null &&
> > > isInputNullable())
> > > {
> > > reportRequiredError();
> > > }
> > > /*isn't something like this missing here?*/ if
> > > (!isValid()) { /*report Conversion error*/ }
> > > if (isValid())
> > > {
> > > validateValidators();
> > > }
> > > }
> > > }
> > >
> >
> > Any thoughts?
> >
> > Thank you!
> > Alex.
> > --
> > View this message in context:
> http://www.nabble.com/Wicket-validation-flaw--tf4390183.html#a12517215
> > 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: Wicket validation flaw?
Posted by Alex Objelean <al...@isdc.ro>.
Done, see here: https://issues.apache.org/jira/browse/WICKET-934 WICKET-934
Matej Knopp-2 wrote:
>
> I thought we were trimming textfield strings, but now i see it's no
> longer the case. Is it a regression or a feature?
>
> Also the missing message doesn't make much sense, can you please
> report a JIRA issue and attach a quick start project?
>
> -Matej
>
> On 9/6/07, Alex Objelean <al...@isdc.ro> wrote:
>>
>> I've discovered the following issue:
>> When using a DateTextField in a form (with the format: dd/MM/yyyy), user
>> by
>> mistake add an extra space (for instance: "06/09/2007 ") and submit the
>> form. The are two problems:
>>
>> 1) I would expect the convertor to convert this value correct, but the
>> AbstractConverter.parse method throws a ConversionException because:
>> (position.getIndex() != stringValue.length())
>>
>> 2) The above exception is not reported anywhere, because validate method
>> does not check if the input is valid after converting its value:
>>
>>
>>
>> > public final void validate()
>> > {
>> > validateRequired();
>> > if (isValid())
>> > {
>> > convertInput();
>> >
>> > if (isValid() && isRequired() &&
>> getConvertedInput() == null &&
>> > isInputNullable())
>> > {
>> > reportRequiredError();
>> > }
>> > /*isn't something like this missing here?*/ if
>> > (!isValid()) { /*report Conversion error*/ }
>> > if (isValid())
>> > {
>> > validateValidators();
>> > }
>> > }
>> > }
>> >
>>
>> Any thoughts?
>>
>> Thank you!
>> Alex.
>> --
>> View this message in context:
>> http://www.nabble.com/Wicket-validation-flaw--tf4390183.html#a12517215
>> 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/Wicket-validation-flaw--tf4390183.html#a12519551
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: Wicket validation flaw?
Posted by Matej Knopp <ma...@gmail.com>.
I thought we were trimming textfield strings, but now i see it's no
longer the case. Is it a regression or a feature?
Also the missing message doesn't make much sense, can you please
report a JIRA issue and attach a quick start project?
-Matej
On 9/6/07, Alex Objelean <al...@isdc.ro> wrote:
>
> I've discovered the following issue:
> When using a DateTextField in a form (with the format: dd/MM/yyyy), user by
> mistake add an extra space (for instance: "06/09/2007 ") and submit the
> form. The are two problems:
>
> 1) I would expect the convertor to convert this value correct, but the
> AbstractConverter.parse method throws a ConversionException because:
> (position.getIndex() != stringValue.length())
>
> 2) The above exception is not reported anywhere, because validate method
> does not check if the input is valid after converting its value:
>
>
>
> > public final void validate()
> > {
> > validateRequired();
> > if (isValid())
> > {
> > convertInput();
> >
> > if (isValid() && isRequired() && getConvertedInput() == null &&
> > isInputNullable())
> > {
> > reportRequiredError();
> > }
> > /*isn't something like this missing here?*/ if
> > (!isValid()) { /*report Conversion error*/ }
> > if (isValid())
> > {
> > validateValidators();
> > }
> > }
> > }
> >
>
> Any thoughts?
>
> Thank you!
> Alex.
> --
> View this message in context: http://www.nabble.com/Wicket-validation-flaw--tf4390183.html#a12517215
> 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