W3C home > Mailing lists > Public > www-forms@w3.org > January 2007

setting xforms control value with javascript

From: Iņaki Salinas Bueno <inksalinas@gmail.com>
Date: Tue, 16 Jan 2007 19:49:48 +0100
Message-ID: <cd3c31800701161049y2f9beeb9kccfa0b8e97933f7e@mail.gmail.com>
To: www-forms <www-forms@w3.org>

I'm trying to set the value of an xforms control using JavaScript: I must
use a JavaScript function, and set the result in the form.

I call the Javascript function following a
Nicholase Chase from IBM (using 'load'), and it works.

I want to use this function:

      document.getElementById('docPKCS7').value = crypto.signText(
document.getElementById('formulari').innerHTML, "auto");

'docPKCS7' must point to xforms control. The right part of the equality
works, but the allocation of the value obtained to the object pointed by
'docPKCS7' not.

This is the code of the xforms control:
<xforms:textarea bind="docPKCS7">

I tried this too:
<xforms:textarea ref="instance('auxiliars')/aux:ajudes/aux:solicitutPKCS7"

And, following some advices from this
I introduce the xhtml:id attribute:
<xforms:textarea ref="instance('auxiliars')/aux:ajudes/aux:solicitutPKCS7"

But nothing works. The javascript console don't show any problem or warning,
except using xhtml:id that appears the following:
Error: document.getElementById("docPKCS7") has no properties

However, the problem is the allocation of the value in the xforms control
because using a HTML textarea it works (the value returned by the function
appears in the textarea):
<textarea id="docPKCS7" rows="5" cols="50"/>

Maybe my problem is related to a namespace conflict (like
but in that case I don't know how to attack it.

Where is the problem? What other things I can test?
Lot of thanks

Received on Tuesday, 16 January 2007 18:50:02 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:19 UTC