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

RE: simple question about buttons in conjunction with javascript

From: Mikko Honkala <honkkis@tml.hut.fi>
Date: Thu, 24 Jan 2002 14:38:36 +0200
To: "Roman Huditsch" <roman.huditsch@hico.com>, <www-forms@w3.org>
Message-ID: <MABBKMMMPFMINOJECBIOAEGPCAAA.honkkis@tml.hut.fi>
Hi Roman,

> How would I have to define a button in pure XFomrs, which starts
> a javascript when I click it?
> Do I have to use xform:dispatch?

For example:

<xforms:button>
	<xforms:caption>Run script</xforms:caption>
	<xforms:script ev:event="xforms:activate" .../>
</xforms:button>

>
> Is there a chance to define a button, which is able to set a
> "relevant"-attribute of a <xform:bind> to the values "yes" or
> "no" when I click it?

This is one way, there may be others:

<xforms:instance xmlns="">
	<my>
	<isRelevant value="true"/>
	<anotherItem/>
	</my>
</xforms:instance>

<xforms:bind ref="/my/anotherItem" relevant="/my/isRelevant='true'"/>

<xforms:button>
  <xforms:caption>Set relevant</xforms:caption>
  <xforms:setValue ev:event="xforms:activate"
   ref="/my/isRelevant/@value"
   value="xforms:if(/my/isRelevant/@value='true','false','true')"/>
</xforms:button>

(I have not tested these, although they should work with X-Smiles, so there
are probably errors)

Regards,
	Mikko Honkala
Received on Thursday, 24 January 2002 07:39:20 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:21:50 GMT