Updating one instance via multiple controls

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Updating one instance via multiple controls

Stephanie Hall (TT)

Hi all,

 

I am hoping someone can help me with a problem I am having regarding updating one instance using 2 different control sets. 

 

I have the following structure in my instance:

 

<instance>

                <projects>

                                <project>

                                                <files>

                                                                <file>

                                                                                <filename>

                                                                                <createdBy>

                                                                </file>

                                                                <file>

                                                                                <filename>

                                                                                <createdBy>

                                                                </file>

</files>

                                </project>

                                <project>

                                …

                </projects>

</instance>

 

In one place in my form, I am displaying the different files for each project in inputs using a repeat

So

                <xforms:repeat nodeset=”files/file” id=”output”>

                                <xforms:input ref=”filename/> <xforms:input ref=”createdBy”/>

                </xforms:repeat>

 

And in the other, I’m using a textarea and doing:

                <xforms:textarea ref=”test”>

                                <xforms:repeat nodeset=”files/file” id=”output”>

                                                <fr:inplace-input ref=”filename/> < fr:inplace-input ref=”createdBy”/><br/>

                                </xforms:repeat>

                </xforms:textarea>

 

When the user updates the first set with the <xforms:input> the changes are reflected in the textarea, but the opposite isn’t occurring.  Could anyone please tell me what I need to do to get that to occur?  I tried looking at recalculate but I don’t know if that is moving in the right direction.

 

And yes, we have to have this setup, where 2 different controls can update the same instance. My client wants an easy way to update large sections of the files (so they want to copy/paste).

 

Thanks!

Stephanie

 

 

 



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Updating one instance via multiple controls

fl.schmitt(ops-users)
Stephanie,

> And in the other, I’m using a textarea and doing:
>
> <xforms:textarea ref=”test”>
>     <xforms:repeat nodeset=”files/file”> id=”output”>
>         <fr:inplace-input ref=”filename/> < fr:inplace-input ref=”createdBy”/><br/>
>     </xforms:repeat>
> </xforms:textarea>

you're referencing a "test" node - but i coulnd't find one in your
model. What's the purpose of this?

another point: you're nesting fr:inplace-input inside an
xforms:textarea. I'm not sure whether this is valid, and if it's
possible to nest two output controls, the purpose of that construct
isn't clear to me. Does it work without the the xforms:textarea? If yes:
do you really need that textarea?

HTH
florian



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Re: Updating one instance via multiple controls

Stephanie Hall (TT)
Hi Florian,

Sorry, "test" is the name of the instance that I included - I forgot to put in the ID.

The "fr:inplace-input" was something I was just trying, and I don't think it's very valid either.  Essentially I want to be able to display the contents of each project/files node in a big textarea as:

Filename createdBy
Filename2 createdBy2
Filename3 createdBy3

And so on without having to create temporary instances to hold the data in the textarea.  My client wants to be able to copy and paste since a project can have 50 or more files under it and it is quite tedious to change them in 50 different inputs.  The "outputs inside a textarea" were just experiments to see if I could get it working since it seems to be working OK except it doesn't update the instance permanently.  

I'm using separate deployment so I don't think I can use the XSLT processor or anything like that, and we really want to avoid temporary instances since we can have over 50 projects also.

Thanks!
Stephanie

-----Original Message-----
From: Florian Schmitt [mailto:[hidden email]]
Sent: Wednesday, September 22, 2010 3:13 AM
To: [hidden email]
Subject: [ops-users] Re: Updating one instance via multiple controls

Stephanie,

> And in the other, I’m using a textarea and doing:
>
> <xforms:textarea ref=”test”>
>     <xforms:repeat nodeset=”files/file”> id=”output”>
>         <fr:inplace-input ref=”filename/> < fr:inplace-input ref=”createdBy”/><br/>
>     </xforms:repeat>
> </xforms:textarea>

you're referencing a "test" node - but i coulnd't find one in your model. What's the purpose of this?

another point: you're nesting fr:inplace-input inside an xforms:textarea. I'm not sure whether this is valid, and if it's possible to nest two output controls, the purpose of that construct isn't clear to me. Does it work without the the xforms:textarea? If yes:
do you really need that textarea?

HTH
florian



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: RE: Re: Updating one instance via multiple controls

fl.schmitt(ops-users)
Hi Stephanie,

> Essentially I want to be able to display the contents of each project/files node in a big textarea as:
>
> Filename createdBy
> Filename2 createdBy2
> Filename3 createdBy3
>
> And so on without having to create temporary instances to hold the data in the textarea.

ah - now i understand.

IMHO there are two separate problems:
1.) Display the file list in the Textarea;
2.) Handle changes of the textarea content.

IMHO it's not a matter of different controls referencing the same
instance nodes. The nucleus of the problem is how to update a nodeset
using the content of a textarea. Using pure XForms, i see no solution,
because textarea is defined to have *single-node binding* attributes,
not *node-set binding* ones. So technically, AFAIK you can't define a
textarea as being bound to a nodeset.

In my own app, i have a similar situation - there's a "bulk paste"
textarea to paste a set of key words to assign them to a data set - the
keywords have a kexword node each, inside a 'keywords' parent node. I've
choosen the temporary instance solution and use Javascript to parse the
content and update the model (splitting the textarea contents on
linebreaks or commata ; issue xforms:insert / xforms:setvalue events to
write the split-up data into the main instance).

If using a temporary instance isn't possible (maybe a single temporary
instance may be sufficiend if it contains some sort of pointer to the
actual project[] ), another way could be to change the instance
structure and let the files node contain the files list in plain text,
without file children. Orboen allows iterating over sequences, too, not
only nodesets [1], so the single parts of a text-only file list are each
accessible to individual xforms controls (using tokenize()), or
altogether for a text-area.

If it would be my decision, i would stay with the files/file/filename
etc structure, because the risk is high that if a line break or space is
missing in the pasted content, filenames are mixed with createdBy
values. Another problem arises if filenames and / or createdBy values
contain spaces itself - then there's no way to decide whether a chunk of
text is a filename, a part of it, or a complete or partial username.
Because of that, i would expect severe problems by entering filename /
username combinations using a bulk-paste mechanism without any validation.

So, the meta-problem is whether using bulk-pasted content for strutured
data. Personally, i would try to refrain from such a solution, if it's
me to decide about that. In my own app, the only risk is that a key word
is split into multiple keyword nodes, and the user can easily detect
such a mistake (i hope :) ).

HTH
florian

[1]
http://wiki.orbeon.com/forms/doc/developer-guide/xforms-repeat#TOC-Iterating-over-plain-values



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws