On 16.04.2007 10:29, Franziska Witzani wrote:
As I explained before, I need to serialize the contents of the data model into the pageLocal-object.
dataModel = myCFormsFormObject.getModel();
So, what I need is more information about the data model object.
You can read the values from it, if you know the id that the corresponding
field had in the form definition. Like:
vorname = dataModel.vorname;
But I need a way to read ALL the values, without explicitly knowing their ids
for being able to read them in a loop.
Unfortunately, I do no longer have that inside view of CForms. But I
wonder if you have access to the Java API. ContainerWidgets like Form
have a method getChildren() returning an Iterator. With it you can
traverse the form model recursively and store the values by the widgets'
getFullName().
pseudo code:
storeValue(formObject.getModel());
function storeValue(model) {
if (model instanceof ContainerWidget) {
for (children in model.getChildren()) {
storeValue(children);
}
} else {
// use model.getFullName() and model.getValue() for storing
}
}
I only wonder how you get the data back into the form model after the
continuation gets called. Is there some pageLocal.restoreState() in
which you can write your loadValue() code?
Also the above looks very much like some data binding. Maybe you can
just reuse the binding framework.
This doesn't work, because it seems to be a Java object.
I found out, that the dataModel-Object must be an instance of Widget.
But in Widget.java I cannot find how the values are held.
Can't follow this part. Is this the same idea I outlined above - and it
does not work? And for what reason? Widget hast a method getValue().
Hope this helps,
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]