You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Carsten Ziegeler <cz...@apache.org> on 2005/07/07 13:48:16 UTC
[CForms] Add isValid() to a widget?
Afaik, there is no way to check in java if a widget is valid.
Does anyone care if I add a isValid() method?
The validate() method can't be used as that method starts the validation
process.
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: [CForms] Add isValid() to a widget?
Posted by Joerg Heinicke <jo...@gmx.de>.
On 07.07.2005 17:32, Carsten Ziegeler wrote:
> Ok, I could cast it to ValidationErrorAware but it
> seems a little bit strange to have a validate() method on the widget but
> no isValid() method.
+1 makes sense.
Joerg
Re: [CForms] ValidationError, Was: Add isValid() to a widget?
Posted by Joerg Heinicke <jo...@gmx.de>.
On 08.07.2005 20:58, Vadim Gritsenko wrote:
> While on the subject of forms validation... I noticed several very
> annoying things:
>
> * Field.getValidationError() *does not* simply return validation error:
> it has side effects!!! It calls getValue() which can invoke parsing
> and validation - depending on state, resulting in weird behavior.
>
> * Field.setValidationError() *does not* simply set validation error:
> it *also* has side effects!!! For some reason it changes widget state,
> which can results in weird behavior.
>
> Any objections on fixing these violations as well?
+1 Of course no objections for fixing side effects.
Joerg
Re: [CForms] ValidationError, Was: Add isValid() to a widget?
Posted by Carsten Ziegeler <cz...@apache.org>.
Vadim Gritsenko wrote:
>
> While on the subject of forms validation... I noticed several very annoying things:
>
> * Field.getValidationError() *does not* simply return validation error:
> it has side effects!!! It calls getValue() which can invoke parsing
> and validation - depending on state, resulting in weird behavior.
>
> * Field.setValidationError() *does not* simply set validation error:
> it *also* has side effects!!! For some reason it changes widget state,
> which can results in weird behavior.
>
> Any objections on fixing these violations as well?
>
Side effects are always bad! +1 from me to fix this.
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
[CForms] ValidationError, Was: Add isValid() to a widget?
Posted by Vadim Gritsenko <va...@reverycodes.com>.
Carsten Ziegeler wrote:
> Carsten Ziegeler wrote:
>
>>Reinhard Poetz wrote:
>>
>>>no, but the interface ValidationErrorAware has and it is implemented by most
>>>model implementations.
>>>
>>>What's your usecase?
>>
>>I just want to check if a widget is valid and then output something in
>>an own transformer. Ok, I could cast it to ValidationErrorAware but it
>>seems a little bit strange to have a validate() method on the widget but
>>no isValid() method.
>
> So anyone against it?
While on the subject of forms validation... I noticed several very annoying things:
* Field.getValidationError() *does not* simply return validation error:
it has side effects!!! It calls getValue() which can invoke parsing
and validation - depending on state, resulting in weird behavior.
* Field.setValidationError() *does not* simply set validation error:
it *also* has side effects!!! For some reason it changes widget state,
which can results in weird behavior.
Any objections on fixing these violations as well?
Vadim
Re: [CForms] Add isValid() to a widget?
Posted by Carsten Ziegeler <cz...@apache.org>.
Carsten Ziegeler wrote:
> Reinhard Poetz wrote:
>
>>no, but the interface ValidationErrorAware has and it is implemented by most
>>model implementations.
>>
>>What's your usecase?
>>
>
> I just want to check if a widget is valid and then output something in
> an own transformer. Ok, I could cast it to ValidationErrorAware but it
> seems a little bit strange to have a validate() method on the widget but
> no isValid() method.
>
So anyone against it?
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: [CForms] Add isValid() to a widget?
Posted by Carsten Ziegeler <cz...@apache.org>.
Reinhard Poetz wrote:
>
> no, but the interface ValidationErrorAware has and it is implemented by most
> model implementations.
>
> What's your usecase?
>
I just want to check if a widget is valid and then output something in
an own transformer. Ok, I could cast it to ValidationErrorAware but it
seems a little bit strange to have a validate() method on the widget but
no isValid() method.
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: [CForms] Add isValid() to a widget?
Posted by Reinhard Poetz <re...@apache.org>.
Carsten Ziegeler wrote:
> Reinhard Poetz wrote:
>
>>Carsten Ziegeler wrote:
>>
>>
>>>Afaik, there is no way to check in java if a widget is valid.
>>>Does anyone care if I add a isValid() method?
>>>
>>>The validate() method can't be used as that method starts the validation
>>>process.
>>
>>
>>Can't you just call getValidationError() and if it returns null you know that
>>there is no error?
>>
>
> Hmm, Widget does not have this method or am I wrong?
no, but the interface ValidationErrorAware has and it is implemented by most
model implementations.
What's your usecase?
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
Re: [CForms] Add isValid() to a widget?
Posted by Carsten Ziegeler <cz...@apache.org>.
Reinhard Poetz wrote:
> Carsten Ziegeler wrote:
>
>>Afaik, there is no way to check in java if a widget is valid.
>>Does anyone care if I add a isValid() method?
>>
>>The validate() method can't be used as that method starts the validation
>>process.
>
>
> Can't you just call getValidationError() and if it returns null you know that
> there is no error?
>
Hmm, Widget does not have this method or am I wrong?
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: [CForms] Add isValid() to a widget?
Posted by Reinhard Poetz <re...@apache.org>.
Carsten Ziegeler wrote:
> Afaik, there is no way to check in java if a widget is valid.
> Does anyone care if I add a isValid() method?
>
> The validate() method can't be used as that method starts the validation
> process.
Can't you just call getValidationError() and if it returns null you know that
there is no error?
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------