Update input box in javascript does not update instance

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

Update input box in javascript does not update instance

Stephanie Hall (TT)

Hi,

 

So I have a select dropdown and an input box in a repeat.  The input is done in xforms and the select in regular HTML.  Using onchange(), when the select changes, I am using javascript to update the value of the input.  I am setting the input correctly (I can see the value like I should) but the instance tag (so <value/>) the input is bound to does not update with the value as well (I save the instance to a file afterward).  Is this a bug?  I’ve seen past mailing list emails that say that doing this with JS and xforms is OK, and this is the right way to do it.

 

Also, when trying to update inputs this way, it seems the instance IDs keep changing between myId$xforms-input-1·1 and myId·1$xforms-input-1 kind of willy nilly. Would it be possible to get this to be consistent? I am using  dev 3.7.1.200905272119.

 

Thanks!

Stephanie



--
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: Update input box in javascript does not update instance

Maciej Arciuch
Are you using raw JS like something.value="myvalue"? If so, I'm afraid Orbeon might be not aware of the change, please make sure you use Orbeon JS function like the ORBEON.xforms.cantremember.setValue(control_id, value).

By the way, why don't you get rid of the JS and simply use a XForms for this? (an action of xforms-value-changed in the dropdown with a setvalue on the input)

Cheers, Maciej
Reply | Threaded
Open this post in threaded view
|

Re: Re: Update input box in javascript does not update instance

Erik Bruchez-3
Maciej is right, you need to use the Orbeon JavaScript function to set
values into form controls:

ORBEON.xforms.Document.setValue()

See:

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-extensions#TOC-Getting-and-Setting-Controls-Value

-Erik

On Wed, Nov 25, 2009 at 1:04 AM, Maciej Arciuch
<[hidden email]> wrote:

>
> Are you using raw JS like something.value="myvalue"? If so, I'm afraid Orbeon
> might be not aware of the change, please make sure you use Orbeon JS
> function like the ORBEON.xforms.cantremember.setValue(control_id, value).
>
> By the way, why don't you get rid of the JS and simply use a XForms for
> this? (an action of xforms-value-changed in the dropdown with a setvalue on
> the input)
>
> Cheers, Maciej
> --
> View this message in context: http://n4.nabble.com/Update-input-box-in-javascript-does-not-update-instance-tp787123p787393.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
>
>


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