how to access xforms:model with javascript with orbeon ?

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

how to access xforms:model with javascript with orbeon ?

vernekap
Hi

how to access xforms:model with javascript with orbeon ? preferably declaratively

with regards
Pralhad
Reply | Threaded
Open this post in threaded view
|

Re: how to access xforms:model with javascript with orbeon ?

Erik Bruchez
Administrator
You can't access the model with JavaScript, at least not directly. See  
this part of the doc for our JavaScript API:

http://www.orbeon.com/ops/doc/reference-xforms-extensions#xforms-javascript

-Erik

On Apr 30, 2009, at 3:37 AM, vernekap wrote:

>
> Hi
>
> how to access xforms:model with javascript with orbeon ? preferably
> declaratively
>
> with regards
> Pralhad
> --
> View this message in context: http://www.nabble.com/how-to-access-xforms%3Amodel-with-javascript-with-orbeon---tp23313640p23313640.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.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
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.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: how to access xforms:model with javascript with orbeon ?

Hank Ratzesberger
Pralhad,

Indeed, you can only access the value in a control. The whole model
is not exposed as a DOM object.  However, you can create a DOM
object from an instance.  I found this necessary when trying to
use google map features.  Using xxforms:serialize and, in your
javascript, e.g. GXml.parse()

<xforms:instance id="stations" src="stations.xml"/>

<xforms:instance id="stations-text">
   <config xmlns="">
     <text/>
   </config>
</xforms:instance>

<xforms:bind nodeset="instance('stations-text')" xmlns:xs="http://
www.w3.org/2001/XMLSchema">
   <xforms:bind nodeset="text" type="xs:string"
     calculate="xxforms:serialize( instance('stations'), 'html' )"/>
</xforms:bind>

And then, perhaps a hidden control bound to the stations-text instance.
Finally, in your javascript,

var StationText = ORBEON.xforms.Document.getValue("stations-text-ctrl");

var staXml = GXml.parse(StationText);
var stations = staXml.getElementsByTagName("pfarr");

So, you can create in JavaScript some instance.  Hopefully it is rare
that you need to do so.

(BTW there is a now a Google map control)

http://wiki.orbeon.com/forms/doc/developer-guide/xbl-existing-xbl- 
components#TOC-Map

Regards,
Hank


On Apr 30, 2009, at 8:27 PM, Erik Bruchez wrote:

> You can't access the model with JavaScript, at least not directly.  
> See this part of the doc for our JavaScript API:
>
> http://www.orbeon.com/ops/doc/reference-xforms-extensions#xforms- 
> javascript
>
> -Erik
>
> On Apr 30, 2009, at 3:37 AM, vernekap wrote:
>
>>
>> Hi
>>
>> how to access xforms:model with javascript with orbeon ? preferably
>> declaratively
>>
>> with regards
>> Pralhad
>> --
>> View this message in context: http://www.nabble.com/how-to-access- 
>> xforms%3Amodel-with-javascript-with-orbeon---tp23313640p23313640.html
>> Sent from the ObjectWeb OPS - Users mailing list archive at  
>> Nabble.com.
>>
>>
>>
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042







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