Accessing instance values from javascript funtions

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

Accessing instance values from javascript funtions

victor panizza-2
Hello All, I have a little question....

How can I access the instance's values from a javascript function...
I know I can access the values via xforms input element

Example:
Access the "name" element some like this ORBEON.xforms.Document.getValue(model('id'), '/name');

or

ORBEON.xforms.Document.setValue(model('id'), '/name', 'value');

<instance id="id">
    <customer>
          <name></name>
          <last-name></last-name>
    </customer>
<instance>


Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool.

--
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: Accessing instance values from javascript funtions

Steve Lenhart
Victor,
 
As far as I'm aware the setValue and getValue seem to be the only JS methods to use OPS values in JS ... what exactly are you trying to achieve?? .... the one caveat with setValue/getValue is that you can not use setValue on an output ... only on an input.... but there are workarounds for this ... like an xforms:input that you make readonly with JS.
 
HTH.
Steve
 
 
 
 
 
STEVE LENHART
WEB DEVELOPER
TELEFLEX CORPORATE IT
155 SOUTH LIMERICK ROAD
LIMERICK, PA 19468
TEL> 610-948-1744
MOB> 484-919-5578
 


   From: victor panizza [mailto:[hidden email]]
Sent: Friday, June 29, 2007 6:06 PM
To: [hidden email]
Subject: [ops-users] Accessing instance values from javascript funtions

Hello All, I have a little question....

How can I access the instance's values from a javascript function...
I know I can access the values via xforms input element

Example:
Access the "name" element some like this ORBEON.xforms.Document.getValue(model('id'), '/name');

or

ORBEON.xforms.Document.setValue(model('id'), '/name', 'value');

<instance id="id">
    <customer>
          <name></name>
          <last-name></last-name>
    </customer>
<instance>


   Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool.



--
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: Accessing instance values from javascript funtions

victor panizza-2
Hi Steve!!

I'm trying to access some instance's values from a  javascript. The fact is that I'm not using controls to ref some instance's elements, what I mean is that I have some instance's elments reference it (ref attribute) and other ones not (no input control for the element). The other ones (no input control for the element) are the elments that I'm trying to acces via javascript.

May be is just a little bit more clear!!!

Any Idea thanksssssssssssssss in advance!!!!!!!!!!!!!!!!


Steve Lenhart <[hidden email]> wrote:
Victor,
 
As far as I'm aware the setValue and getValue seem to be the only JS methods to use OPS values in JS ... what exactly are you trying to achieve?? .... the one caveat with setValue/getValue is that you can not use setValue on an output ... only on an input.... but there are workarounds for this ... like an xforms:input that you make readonly with JS.
 
HTH.
Steve
 
 
 
 
 
STEVE LENHART
WEB DEVELOPER
TELEFLEX CORPORATE IT
155 SOUTH LIMERICK ROAD
LIMERICK, PA 19468
TEL> 610-948-1744
MOB> 484-919-5578
 


   From: victor panizza [mailto:[hidden email]]
Sent: Friday, June 29, 2007 6:06 PM
To: [hidden email]
Subject: [ops-users] Accessing instance values from javascript funtions

Hello All, I have a little question....

How can I access the instance's values from a javascript function...
I know I can access the values via xforms input element

Example:
Access the "name" element some like this ORBEON.xforms.Document.getValue(model('id'), '/name');

or

ORBEON.xforms.Document.setValue(model('id'), '/name', 'value');

<instance id="id">
    <customer>
          <name></name>
          <last-name></last-name>
    </customer>
<instance>

   Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool.

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


Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.

--
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: Accessing instance values from javascript funtions

Erik Bruchez
Administrator
In reply to this post by victor panizza-2
Victor,

For security reasons, you can't access instances from JavaScript. If you
want to do that, you have to do it indirectly, the simplest way being to
use the JavaScript API to access an input control's value, but making
that control invisible with CSS. You probably have already seen the API
for accessing control values:

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

If we allowed JavaScript to freely access instances, anybody could hack
your application by writing a bit of JavaScript ;-)

-Erik

victor panizza wrote:

> Hello All, I have a little question....
>
> How can I access the instance's values from a javascript function...
> I know I can access the values via xforms input element
>
> Example:
> Access the "name" element some like this
> ORBEON.xforms.Document.getValue(model('id'), '/name');
>
> or
>
> ORBEON.xforms.Document.setValue(model('id'), '/name', 'value');
>
> <instance id="id">
>     <customer>
>           <name></name>
>           <last-name></last-name>
>     </customer>
> <instance>
--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws