How to Update model from javascript

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

How to Update model from javascript

Andrew Bailey
Hi

I have used
<script>
ORBEON.xforms.Document.setValue("selectedpart",message);
</script>
to set the value of an input control which then updates the model that
was bound to it

I wanted to update the bind directly to avoid having to have an input
control that I dont want the user ever to see or enter a value
and so used the id of the bind, it seemed the logical thing to do.
It didnt work!

Can someone please tell me how to do it?

Also it would be good to update the docs to explain how.

Thanks

--
Andrew Bailey
http://www.hazlorealidad.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: How to Update model from javascript

Erik Bruchez
Administrator
> Hi

>
> I have used
> <script>
> ORBEON.xforms.Document.setValue("selectedpart",message);
> </script>
> to set the value of an input control which then updates the model that
> was bound to it
>
> I wanted to update the bind directly to avoid having to have an input
> control that I dont want the user ever to see or enter a value
> and so used the id of the bind, it seemed the logical thing to do.
> It didnt work!
>
> Can someone please tell me how to do it?
At the moment you can't update a bind directly from JavaScript. You  
have to use an input control. You can hide it with CSS though.

> Also it would be good to update the docs to explain how.

N/A since you can't do it ;-)

-Erik

--
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 Update model from javascript

Alessandro Vernet
Administrator
Andrew,

On Fri, Jul 18, 2008 at 10:09 PM, Erik Bruchez <[hidden email]> wrote:
> At the moment you can't update a bind directly from JavaScript. You have to
> use an input control. You can hide it with CSS though.

And the reason it is done this way isn't to annoy you, as you might
think :), but rather for security reasons: the server won't allow the
browser to just set the value of a node in an instance, unless there
is a control bound that node. This is to prevent some ill intentioned
users of your application from doctoring Ajax requests to modify parts
of the instance they shouldn't have access to.

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/
Twitter - http://twitter.com/avernet


--
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: Re: How to Update model from javascript

Andrew Bailey
> And the reason it is done this way isn't to annoy you, as you might
> think :), but rather for security reasons: the server won't allow the
> browser to just set the value of a node in an instance, unless there
> is a control bound that node. This is to prevent some ill intentioned
> users of your application from doctoring Ajax requests to modify parts
> of the instance they shouldn't have access to.
>
That make sense but I have a suggestion, how about only being able to
modify parts of the model that have a <xf:bind
possibly with a readonly="false" or an xxforms:mayscript="true" or similar,
that also makes sense and then the developer wouldnt have to resort to
hiding input controls with css.

Anyhow for the meantime I can solve my problem great, thanks very much

Andy Bailey
http://www.hazlorealidad.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: Re: Re: How to Update model from javascript

Erik Bruchez
Administrator
> That make sense but I have a suggestion, how about only being able to
> modify parts of the model that have a <xf:bind
> possibly with a readonly="false" or an xxforms:mayscript="true" or  
> similar,
> that also makes sense and then the developer wouldnt have to resort to
> hiding input controls with css.

Yes, that would be doable. Having to use a control is in fact annoying.

-Erik

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