Re: [Xsltforms-support] How to click a <trigger> from script?
Brought to you by:
alain-couthures
From: COUTHURES A. <ala...@ag...> - 2009-06-17 05:55:41
|
Hi Micah, Here is an example of Javascript Trigger Activation : <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" > <head> <title>Javascript Trigger Activation Example</title> <xf:model/> </head> <body onload="$('console').style.display = 'block';"> <xf:trigger> <xf:label>Button 1</xf:label> <xf:message level="modal" ev:event="DOMActivate">Hello from Button 1</xf:message> <xf:load ev:event="DOMActivate" resource="javascript:$('button2').xfElement.click()"/> </xf:trigger> <xf:trigger id="button2"> <xf:label>Button 2</xf:label> <xf:message level="modal" ev:event="DOMActivate">Hello from Button 2</xf:message> </xf:trigger> </body> </html> I have tested it with the committed work version in the SVN repository. I'm not sure it would also work with the beta version for many reasons... Hope it helps. -Alain |