RE: simple question about buttons in conjunction with javascript

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 UTC