How to Update model from javascript

View: New views
5 Messages — Rating Filter:   Alert me  

How to Update model from javascript

by Andrew Bailey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Re: How to Update model from javascript

by Erik Bruchez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> 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 ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Re: Re: How to Update model from javascript

by Alessandro Vernet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andrew,

On Fri, Jul 18, 2008 at 10:09 PM, Erik Bruchez <ebruchez@...> 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 ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/

Re: Re: Re: How to Update model from javascript

by Andrew Bailey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> 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 ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Re: Re: Re: Re: How to Update model from javascript

by Erik Bruchez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> 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 ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws