cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: [cforms] Widget states in request-scoped forms
Date Mon, 14 Mar 2005 23:08:56 GMT
Reinhard Poetz wrote:

> Sylvain Wallez wrote:
>
>> Reinhard Poetz wrote:
>>
>>>
>>> Today I've tried to run a form that uses the widget state 
>>> "INVISIBLE" and when the form state is saved in the request. (my 
>>> experiments are based on the form1 action example)
>>>
>>> If I use the event framework to change the state from ACTIVE to 
>>> INVISIBLE, toggling works, but the value of the changed widget gets 
>>> lost.
>>>
>>> Looking at the samples I can't figure out ...
>>>
>>> - How can a widget have the state "INVISIBLE"? Where is this 
>>> information stored, or better from where is it read?
>>
>>
>>
>>
>> Have a look at AbstractWidget.{get|set|getCombined}State() and also 
>> at WidgetState.
>>
>>> - If I'm right and the described behavior (losing the values of 
>>> INVISIBLE widgets) is a bug, how can it be fixed? Any ideas?
>>
>>
>>
>>
>> If it behaves as you describe it, then yes it's a bug. A field only 
>> reads its value when in ACTIVE state, and keeps its current value 
>> otherwise.
>
>
> and here seems to be the bug: the inactive widget can't keep its state 
> as its state would have to be available as request parameter and this 
> never comes (as it's inactive).


Hmm... before being invisible, the widget is active, no? So that means 
that its value is submitted along with the action that will change the 
state. So, except if you have some fancy layout, it should read its 
value before having its state changed.

And later, once invisible, the widget doesn't read its value on the request.

>> However, a field does read its value from the request when switched 
>> from ACTIVE to INVISIBLE: Form.readFromRequest() traverses the whole 
>> widget tree and buffers any event occuring during this phase and 
>> fires them when after traversal. This is needed for the widget tree 
>> to be globally consistent when listeners are called.
>>
>> Maybe you're experiencing such a condition, i.e. the http submit that 
>> changes to inactive state doesn't contain the appropriate parameter?
>
>
> think so. the value of the invisible widget can't be set as it isn't 
> available (at least looking at the HTML sources makes me think so).


Yes, but how is the HTML before doing the action that makes it invisible?

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Mime
View raw message