Models, instances and serialize() function

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

Models, instances and serialize() function

Jesús Damián Jiménez Re
Hi all,

I'm trying to initializate an instance field with the serialize value from another instance.

I've coded following code:

<xhtml>
...
   <!-- modelA.xform includes an 'instanceA' element -->

   <xi:include href="...modelA.xform">...

<xforms:model id="modelB">
   <xforms:instance id="instanceB">
      <MyInstanceB>
          <FieldA xmlns="">Value of field A</FieldA>
          <FieldB xmlns=""/>
      </MyInstanceB>
   </xforms:instance>

   <xforms:bind nodeset="instance('instanceB')/FieldB"
    calculate="xxforms:serialize(instance('instanceA')/MyInstanceA,'xml')"/>
</xforms:model>
...
</xhtml>
         
But it doesn't work :( .  
Maybe is't not possible to serialize a instance from a external model?


Thank you in advance for your help,

Jesus Damian



--
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: Models, instances and serialize() function

Alessandro Vernet
Administrator
Jesús,

On Thu, Feb 21, 2008 at 2:58 AM, Jesús Damián Jiménez Re
<[hidden email]> wrote:
> Hi all,
>
>  I'm trying to initializate an instance field with the serialize value from another instance.
>
>  I've coded following code:
>  [...]

The code looks right to me. Are you getting an error message? Can you
create an example that runs in the XForms sandbox and that reproduces
this?

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/


--
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: Models, instances and serialize() function

Jesús Damián Jiménez Re
Hi Alessandro,

I've just to create a example that you can execute in the XForms sandbox (example1.xhtml). That example doesn't work.

I've just realize that if you move both instances to the same model, it's work. The example2.xhtml shows this case (it's work). But I require the instances in separate models ... :(

Do you know if it is a bug ?


Jesús Damián Jiménez Re
Jefe de Proyectos I+D+i
Bahía Information Technology, S.A.
 
Avda. Teniente Montesinos, 8,
Edificio INTI, Torre A, 7ª planta, 30.100 - Murcia
Tel: 968 22 63 64 ext. 220
Fax: 968 22 07 44
 

> -----Mensaje original-----
> De: [hidden email] [mailto:[hidden email]] En nombre de Alessandro
> Vernet
> Enviado el: jueves, 28 de febrero de 2008 1:57
> Para: [hidden email]
> Asunto: [ops-users] Re: Models, instances and serialize() function
>
> Jesús,
>
> On Thu, Feb 21, 2008 at 2:58 AM, Jesús Damián Jiménez Re
> <[hidden email]> wrote:
> > Hi all,
> >
> >  I'm trying to initializate an instance field with the serialize value
> from another instance.
> >
> >  I've coded following code:
> >  [...]
>
> The code looks right to me. Are you getting an error message? Can you
> create an example that runs in the XForms sandbox and that reproduces
> this?
>
> Alex
> --
> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
> Orbeon's Blog: http://www.orbeon.com/blog/
> Personal Blog: http://avernet.blogspot.com/


--
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

example1.xhtml (1K) Download Attachment
example2.xhtml (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: RE: Re: Models, instances and serialize() function

Alessandro Vernet
Administrator
On Wed, Mar 12, 2008 at 7:14 AM, Jesús Damián Jiménez Re
<[hidden email]> wrote:
>  I've just to create a example that you can execute in the XForms sandbox (example1.xhtml). That example doesn't work.

Ok, I can now run your example. The problem is that if you are in the
context of a given model, instance('gaga') will only return you an
instance with ID gaga in the current model. It won't return an
instance with that name in another model. This is how instance() is
defined in the XForms specification. Yes, I know, this is not
intuitive at all!

In Orbeon Forms, since ID for instances need to be unique accross
models, we have xxforms:instance() which behaves like instance() but
also looks in other models. So this is what you want to use in this
case.

For reference, I attached a copy of your updated example.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/


--
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

example1.xhtml (2K) Download Attachment