You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Franziska Witzani <fr...@e-tecture.com> on 2007/05/08 17:16:04 UTC

Problems with serialization and Union Widget

Hi there!

Is there anybody who can tell me where the location (which method in which call) is, where the Form-object reads it’s values from the request?
Or, more precisely, where it decides which widgets have been updated or not?

I’d like to know this, because I am facing a problem with using the Union Widget.

Imagine the following case (sorry for the complex explanation!): 
A form containing a union widget, which itself contains several widgets (which are displayed exclusively, depending on another widget…- this is actually what union widget is for - …lets call them Inner-Widgets!).

This form is displayed (lets say Inner-Widget #1 is displayed), the user submits the form, afterwards the form reads its values from the request. So far, so good.
Later on, the user decides to go back (with continuations) because he wants to change the values of the form. There he changes as well the value of the widget which decides which Inner-Widget is displayed. So another Inner-Widget ( Inner-Widget #2) is displayed and sends its values with the request.

The problem is now the following:
The Form-object now holds both the values the user has entered in Inner-Widget #1 and those of Inner-Widget #2.
But if I want to serialize the values dynamically (like: plz, form-object, write all your values into the PageLocal-Object… [we had that some time ago])  it is necessary that the Form-Object somehow throws away all the values that didn’t come with the request.
But it doesn’t. 

With searching the source code I came so far that I found the methods where the fields read their new values, but there must be a place where something like “Set updatedWidgets” is set. (this is e.g. from Form.java)
Can anybody tell me where to look, or even better, if there is a way to somehow parameterize the form that it always updates itself with ALL its values and not only those, which came with the request?

The thing seems to be that this Set of updatedWidgets only consists of the parameters sent with the HTTP-Request. So the Form-Object does not know that the values of Inner-Widget #1 should be deleted, because there were no more html-elements of Inner-Widget #1.

Regards and thanks a lot for your answers already!

Franzi

 

PS: Another solution could be changing the javascript that restructures the HTML on the client-side after changing the value of the widget that decides about the displayed Inner-Widget. And after the change setting the values of Inner-Widget #1 to null.
Does anybody know where that is?