Hi,
I have an instance: <xforms:instance id="xquery"> <xquery> <query/> </xquery> </xforms:instance> which has a textbox as its control (ref="instance('xquery')/query"). On the form, there also select1 which are also tied to the textbox via JavaScript: <xforms:select1 onchange="this.form.queryBox.value=this.value" ref="instance('queryInstance')/example" appearance="minimal"> <xforms:itemset nodeset="instance('examples')/query"> <xforms:label ref="description"/> <xforms:value ref="code"/> </xforms:itemset> </xforms:select1> Now when I use one of the selects, the appropriate code appears in the textbox but when I then submit the form (instance = 'xquery'), the contents of the textbox have not been bound to <query/>. The only way I seem to be able to get this to work is to do something in the textbox, e.g. hit return or add a space, prior to submitting the form. I have tried putting a setvalue with the select1 so that <query/> will get set with a xforms-select or DOMActivate event but this does nothing. What am I missing here? Cheers, Matthew -- 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 |
Administrator
|
Hi Matthew,
Good question. If you want to set the value of a control from JavaScript, you need do this calling ORBEON.xforms.Document.setValue(). For more on this API, see: http://www.orbeon.com/ops/doc/reference-xforms-ng#xforms-javascript-get-set-value Just setting the value of the HTML field doesn't work because the XForms engine needs to do some work when the value of a control is set (update the instance, xforms-value-changed, validation, ...). Note that right now this only works for <xforms:input> controls. If you have some other control, you can get around this limitation by adding an <xforms:input> bound to the same node with CSS style visibility: hidden so the <xforms:input> doesn't show in the UI. Alex On 4/20/07, Matthew Graham <[hidden email]> wrote: > Hi, > > I have an instance: > > <xforms:instance id="xquery"> > <xquery> > <query/> > </xquery> > </xforms:instance> > > which has a textbox as its control (ref="instance('xquery')/query"). On > the form, there also select1 which are also tied to the textbox via > JavaScript: > > <xforms:select1 onchange="this.form.queryBox.value=this.value" > ref="instance('queryInstance')/example" appearance="minimal"> > <xforms:itemset nodeset="instance('examples')/query"> > <xforms:label ref="description"/> > <xforms:value ref="code"/> > </xforms:itemset> > </xforms:select1> > > Now when I use one of the selects, the appropriate code appears in the > textbox but when I then submit the form (instance = 'xquery'), the > contents of the textbox have not been bound to <query/>. The only way I > seem to be able to get this to work is to do something in the textbox, > e.g. hit return or add a space, prior to submitting the form. I have > tried putting a setvalue with the select1 so that <query/> will get set > with a xforms-select or DOMActivate event but this does nothing. > > What am I missing here? > > Cheers, > > Matthew > > > > -- > 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 > > -- Orbeon Forms - Web 2.0 Forms 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 |
Free forum by Nabble | Edit this page |