Getting instance data into javascript

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

Getting instance data into javascript

Shaw, Richard A
Getting instance data into javascript

Does anybody know how I can get a lump of GML data from one of my Xform instances into my javascript ?

I have a javascript implemented map on my page and I need to provide it with the GML so that it can transform it on the client when the map is zoomed.

My xforms submission produces a response as follows -

<result>
        <instructions>
                <div>
                        … html table
                </div>
        </instructions>
        <gml>
                ...
        </gml>
</result

I serialize the contents of the instructions element using an xforms:output which puts the text description of my gml onto the screen but I don't know how to get the gml section into my javascript.

Thanks in advance.

Richard Shaw

¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤

Richard Shaw  
Technical Design Authority - Information Solutions Consultancy  
Intelligent Transport Systems

Atkins Highways and Transportation
Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW

Tel: +44 (0) 1372 756407 
Fax: +44 (0) 1372 740055
Mob: 07740 817586 
E-mail: [hidden email]

www.atkinsglobal.com/its



This email and any attached files are confidential and copyright protected. If you are not the addressee, any dissemination of this communication is strictly prohibited. Unless otherwise expressly agreed in writing, nothing stated in this communication shall be legally binding.

The ultimate parent company of the Atkins Group is WS Atkins plc. Registered in England No. 1885586. Registered Office Woodcote Grove, Ashley Road, Epsom, Surrey KT18 5BW.

P Consider the environment. Please don't print this e-mail unless you really need to.



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Getting instance data into javascript

Hank Ratzesberger

I can only second the motion.

I have had to create services in order to share data with javascript.  The 
XForms performs submissions to the service and the the javascript  uses
httpXMLRequest.

But if the application/ and server have the instance, it would be great if 
there were a way to obtain it similar to the default submission instance.
e.g.:


Then javascript functions could be called on the xforms-value-changed
or other events with the current extension.

(Apologies to Orbeon for suggesting a feature of unknown scope, 
obviously there are issues about what/how instances should be 
exposed.)

--Hank

Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042


On Sep 24, 2007, at 12:34 AM, Shaw, Richard A wrote:

Does anybody know how I can get a lump of GML data from one of my Xform instances into my javascript ?

I have a javascript implemented map on my page and I need to provide it with the GML so that it can transform it on the client when the map is zoomed.

My xforms submission produces a response as follows -

<result>
        <instructions>
                <div>
                        … html table
                </div>
        </instructions>
        <gml>
                ...
        </gml>
</result

I serialize the contents of the instructions element using an xforms:output which puts the text description of my gml onto the screen but I don't know how to get the gml section into my javascript.

Thanks in advance.

Richard Shaw

¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤

Richard Shaw  
Technical Design Authority - Information Solutions Consultancy  
Intelligent Transport Systems

Atkins Highways and Transportation
Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW

Tel: +44 (0) 1372 756407 
Fax: +44 (0) 1372 740055
Mob: 07740 817586 
E-mail: [hidden email]

www.atkinsglobal.com/its



This email and any attached files are confidential and copyright protected. If you are not the addressee, any dissemination of this communication is strictly prohibited. Unless otherwise expressly agreed in writing, nothing stated in this communication shall be legally binding.

The ultimate parent company of the Atkins Group is WS Atkins plc. Registered in England No. 1885586. Registered Office Woodcote Grove, Ashley Road, Epsom, Surrey KT18 5BW.

P Consider the environment. Please don't print this e-mail unless you really need to.



--







--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Getting instance data into javascript

Alessandro Vernet
Administrator
In reply to this post by Shaw, Richard A
Richard,

On 9/24/07, Shaw, Richard A <[hidden email]> wrote:
> Does anybody know how I can get a lump of GML data from one of my Xform
> instances into my javascript ?

You seem to have already that piece of XML serialized in an node, and
you have a control bound to that node. So the only think you need is
to use the JavaScript API ORBEON.xforms.Document.getValue("myControl")
to get the value of that control. See:

http://www.orbeon.com/ops/doc/reference-xforms-2#xforms-javascript-get-set-value

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Getting instance data into javascript

Alessandro Vernet
Administrator
In reply to this post by Hank Ratzesberger
Hank,

On 9/24/07, Hank Ratzesberger <[hidden email]> wrote:
> I have had to create services in order to share data with javascript.  The
> XForms performs submissions to the service and the the javascript  uses
> httpXMLRequest.

Wouldn't ORBEON.xforms.Document.getValue("myControl") do the trick? Or
do you need something that can't be done with this?

> Then javascript functions could be called on the xforms-value-changed
> or other events with the current extension.

You should be able to do this with an <xxforms:script
ev:event="xforms-value-changed">You JavaScript code
here</xxforms:script> action.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Getting instance data into javascript

Shaw, Richard A
In reply to this post by Alessandro Vernet
I tried to serialise to a hidden xforms:output and then use get value on that but it seems to have converted my XML into HTML. I'll try it again  with an xforms:input.


Richard Shaw

¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤

Richard Shaw  
Technical Design Authority - Information Solutions Consultancy  
Intelligent Transport Systems

Atkins Highways and Transportation
Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW

Tel: +44 (0) 1372 756407
Fax: +44 (0) 1372 740055
Mob: 07740 817586
E-mail: [hidden email]

www.atkinsglobal.com/its

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Alessandro Vernet
Sent: 25 September 2007 01:07
To: [hidden email]
Subject: Re: [ops-users] Getting instance data into javascript

Richard,

On 9/24/07, Shaw, Richard A <[hidden email]> wrote:
> Does anybody know how I can get a lump of GML data from one of my
> Xform instances into my javascript ?

You seem to have already that piece of XML serialized in an node, and you have a control bound to that node. So the only think you need is to use the JavaScript API ORBEON.xforms.Document.getValue("myControl")
to get the value of that control. See:

http://www.orbeon.com/ops/doc/reference-xforms-2#xforms-javascript-get-set-value

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise http://www.orbeon.com/



This message has been scanned for viruses by MailControl - (see http://bluepages.wsatkins.co.uk/?6875772)


This email and any attached files are confidential and copyright protected. If you are not the addressee, any dissemination of this communication is strictly prohibited. Unless otherwise expressly agreed in writing, nothing stated in this communication shall be legally binding.

The ultimate parent company of the Atkins Group is WS Atkins plc.  Registered in England No. 1885586.  Registered Office Woodcote Grove, Ashley Road, Epsom, Surrey KT18 5BW.

Consider the environment. Please don't print this e-mail unless you really need to.



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Getting instance data into javascript

Hank Ratzesberger
In reply to this post by Alessandro Vernet

Hi Alex,

I have never tried to bind an entire instance to a single control.
I have about 2K of data (also map position points + ).  I concluded 
that the binding reference had to resolve to a basic schema type,
xs:string, xs:dateTime, etc.

I use ...getValue("myControl") currently to get the ranges for the 
db query, but both the xforms and the javascript make the same 
(rest style) submission/get to the eXist db.  If the xforms can do 
the submission, and the javascript (Google Map API code) can 
obtain the xml document from a control, that would be ideal.

I am upgrading hardware and cannot stop for a while to test this.

Thank you,
--Hank

On Sep 24, 2007, at 5:10 PM, Alessandro Vernet wrote:

Hank,

On 9/24/07, Hank Ratzesberger <[hidden email]> wrote:
I have had to create services in order to share data with javascript.  The
XForms performs submissions to the service and the the javascript  uses
httpXMLRequest.

Wouldn't ORBEON.xforms.Document.getValue("myControl") do the trick? Or
do you need something that can't be done with this?

Then javascript functions could be called on the xforms-value-changed
or other events with the current extension.

You should be able to do this with an <xxforms:script
ev:event="xforms-value-changed">You JavaScript code
here</xxforms:script> action.

Alex
-- 
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise


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

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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Getting instance data into javascript

Alessandro Vernet
Administrator
Hank,

On 9/25/07, Hank Ratzesberger <[hidden email]> wrote:
> I have never tried to bind an entire instance to a single control.
> I have about 2K of data (also map position points + ).  I concluded
> that the binding reference had to resolve to a basic schema type,
> xs:string, xs:dateTime, etc.

Right, it has to be a simple type. So the idea is that if you have an
instance that contains the document you want to access (say id="map"),
you use another instance, and have an element of that instance (say
<map/>) calculated as saxon:serialize(instance('map'), 'xml'). So you
have the actual serialized XML as a string in the element <map/>. Then
you bind a control to that element and can access the value of the
element from JavaScript with
ORBEON.xforms.Document.getValue("myControl").

Does this make sense?

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Getting instance data into javascript

Alessandro Vernet
Administrator
In reply to this post by Shaw, Richard A
Richard,

On 9/25/07, Shaw, Richard A <[hidden email]> wrote:
> I tried to serialise to a hidden xforms:output and then use get value on that but it seems to have converted my XML into HTML. I'll try it again  with an xforms:input.

OK, let us know how this works.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Getting instance data into javascript

Hank Ratzesberger
In reply to this post by Alessandro Vernet
Yes, perfect sense. 

Just need to parse the string to DOM in JavaScript
(formerly handled by the map API httpXMLRequest).

Thank you,
Hank

On Sep 25, 2007, at 11:27 AM, Alessandro Vernet wrote:

Hank,

On 9/25/07, Hank Ratzesberger <[hidden email]> wrote:
I have never tried to bind an entire instance to a single control.
I have about 2K of data (also map position points + ).  I concluded
that the binding reference had to resolve to a basic schema type,
xs:string, xs:dateTime, etc.

Right, it has to be a simple type. So the idea is that if you have an
instance that contains the document you want to access (say id="map"),
you use another instance, and have an element of that instance (say
<map/>) calculated as saxon:serialize(instance('map'), 'xml'). So you
have the actual serialized XML as a string in the element <map/>. Then
you bind a control to that element and can access the value of the
element from JavaScript with
ORBEON.xforms.Document.getValue("myControl").

Does this make sense?

Alex
-- 
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise


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

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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Getting instance data into javascript

Alessandro Vernet
Administrator
Hank,

On 9/25/07, Hank Ratzesberger <[hidden email]> wrote:
> Yes, perfect sense.
>
> Just need to parse the string to DOM in JavaScript
> (formerly handled by the map API httpXMLRequest).

Exactly.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws