- From: Roman Huditsch <roman.huditsch@hico.com>
- Date: Tue, 30 Sep 2003 13:29:03 +0200
- To: "Mark Birbeck" <Mark.Birbeck@x-port.net>
- Cc: <www-forms@w3.org>
- Message-ID: <0C79A363CB0321418927D0CB1AD0403C29AB6F@hicoetsrv000006.hico.local>
Hi Mark, Thank you very much for your quick reply. You are definitely right about the limitations of the old onClick attribute. But given your example for calling my script, I could not find any reference to a for or event attribute in the XHTML specification as you used them in for example. Could you please point me to the right direction on this topic? Because I could not figure out how to build up this kind of reference to a Javascript using XML Events. Thanks. with best regards, Roman Mag.(FH) Roman Huditsch (hRHU ) Developer .:. Information & Application Engineering _____________________________________________________________________ hico Informations- und Kommunikations-Management Gesellschaft m.b.H. TechLab, Thomas A. Edison Straße 2. A-7000 Eisenstadt / Austria phone: +43/2682/704-61-73; fax: +43/2682/704-71-61-10 e-mail: roman.huditsch@hico.com mobile: +43/664/4102715 -----Ursprüngliche Nachricht----- Von: Mark Birbeck [mailto:Mark.Birbeck@x-port.net] Gesendet: Dienstag, 30. September 2003 13:06 An: Roman Huditsch Cc: 'www-forms@w3.org ' Betreff: RE: Defining "onClick"-Events in XForms Controls Hi Roman, > How would I define a "onClick"-Event in an XForms control that calls a > Javascript function? > > Would it look like > > <xforms:trigger html:onClick="javascript:test();">... No. Before we look at how it's done, it's worth just pointing out how the approach you suggest illustrates well the limitations of the old-style (HTML) event definition versus XML Events, as used in XForms. As you can see in your suggested code you could only ever have one handler at a time for the onClick event on your element, if we use an attribute to specify it. In XForms you can have as many handlers as you like, since they can be expressed externally to the element that the event will originate from. Also note that the problem with the name "onClick" is that it is device specific. It implies something like a mouse, and in turn, that the xf:trigger is a button. But in a voice system (for example) an xf:trigger will not be a gray button, and activating the xf:trigger will not involve a mouse-click. In DOM 2 Events the event name DOMActivate is used to indicate that the element has been "activated" in some way. Obviously in a visual system this is most likely to be with a mouse, but might not be. So, if you wanted to show a message when a trigger is activated you could do this: <xforms:trigger id="tr"> <xforms:label>Test</xforms:label> <xforms:message level="modal" ev:event="DOMActivate"> Testing 1 2 3 </xforms:message> </xforms:trigger> And to execute your JavaScript routine, you could add this: <script for="tr" event="DOMActivate" language="JavaScript"> alert('Add some code here'); </script> As this sample stands, *both* the message and your inline JavaScript would get executed, one after the other, but note that although DOM 2 Events allows many handlers to be attached to the same event, there is no way to specify what order they occur in. Regards, Mark Mark Birbeck x-port.net Ltd.
Received on Tuesday, 30 September 2003 07:26:26 UTC