Duplicating a Model Instance

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

Duplicating a Model Instance

gandrewsms
Is there a simple way to duplicate a model instance (deep copy every
element) without resorting to a <repeat> <insert> via a user interface
control.  I basically need to create 2 copies as opposed to a single
copy of an instance from an http POST via a submission statement like
this one below -- I need to avoid any user interface controls in doing
this.
   <xf:submission replace="instance" instance="inst-rs-receive"
ref="instance('inst-rs-send')" />


_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

RE: Duplicating a Model Instance

Klotz, Leigh
You can do it with xforms 1.1 features, but if you must do it now, you
will need either JavaScript action handlers or a second submission with
<xf:send submission="inst-dup" ev:event="xforms-submit-done" /> which
simply goes round-trip web server that echoes back the data.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of glenn
andrews
Sent: Wednesday, September 12, 2007 1:11 PM
To: [hidden email]
Subject: Duplicating a Model Instance

Is there a simple way to duplicate a model instance (deep copy every
element) without resorting to a <repeat> <insert> via a user interface
control.  I basically need to create 2 copies as opposed to a single
copy of an instance from an http POST via a submission statement like
this one below -- I need to avoid any user interface controls in doing
this.
   <xf:submission replace="instance" instance="inst-rs-receive"
ref="instance('inst-rs-send')" />


_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: Duplicating a Model Instance

Mark Seaborne-3
In reply to this post by gandrewsms
Hi,

If you can get away with using insert (which will just duplicate a
structure within the same instance) then
you don't have to use insert with a repeat in the UI, you can just as
easily use it within the model:

<xf:submission replace="instance" instance="inst-rs-receive"  
ref="instance('inst-rs-send')" >
        <xf:insert nodeset="instance('inst-rs-receive')/someNode" at="last()"
position="after" ev:event="xforms-submit-done"/>
</xf:submission>

However, if you truly want 2 instances then you need to heed Leigh.

Mark

On Wed, 12 Sep 2007 15:10:34 -0500, glenn andrews wrote:

> Is there a simple way to duplicate a model instance (deep copy every
> element) without resorting to a <repeat> <insert> via a user interface
> control.  I basically need to create 2 copies as opposed to a single
> copy of an instance from an http POST via a submission statement like
> this one below -- I need to avoid any user interface controls in doing
> this.
>    <xf:submission replace="instance" instance="inst-rs-receive"
> ref="instance('inst-rs-send')" />
>
>
> _______________________________________________
> dev-tech-xforms mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-tech-xforms
Mark Seaborne
Senior Standards Architect
PicoForms
web:    http://www.picoforms.com
e-mail: [hidden email]
tel: +44 131 2080031
mobile:  +44 787 2180215

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms