Differences between revisions 1 and 2
Revision 1 as of 2005-01-21 04:15:49
Size: 1382
Editor: ScottEade
Comment: Migrated page.
Revision 2 as of 2009-09-20 22:00:12
Size: 1384
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
Action Events are a very powerful mechanism to develop web interfaces. It allows you to attach buttons in your web form to method calls in a class. The [http://jakarta.apache.org/turbine/turbine/turbine-2.3.1/howto/action-event-howto.html Action Events How To] provides a good description of how to use this tool. This part of the tutorial presents an approach to extend the use of action events, attaching every kind of javascript event (e.g.: onBlur, onClick, onMouseOver) to method calls in the Action''''''Event class. Action Events are a very powerful mechanism to develop web interfaces. It allows you to attach buttons in your web form to method calls in a class. The [[http://jakarta.apache.org/turbine/turbine/turbine-2.3.1/howto/action-event-howto.html|Action Events How To]] provides a good description of how to use this tool. This part of the tutorial presents an approach to extend the use of action events, attaching every kind of javascript event (e.g.: onBlur, onClick, onMouseOver) to method calls in the Action''''''Event class.

Action Events

Action Events are a very powerful mechanism to develop web interfaces. It allows you to attach buttons in your web form to method calls in a class. The Action Events How To provides a good description of how to use this tool. This part of the tutorial presents an approach to extend the use of action events, attaching every kind of javascript event (e.g.: onBlur, onClick, onMouseOver) to method calls in the ActionEvent class.

Wrapping the document.yourform.submit() function in javascript is a common practice that allows you to validate the fields of the form before submitting. In order to attach js events to method calls you need to do something similar:

  • put a hidden element in the form:

    <input type="hidden" name="actionevent" value=''''''> 

  • wrap the form.submit() in a js function that changes the actionevent name

    doSubmit(actionevent_name){ 
       document.formname.actionevent.name=actionevent_name;  
       document.formname.submit(); 
    }
  • and call it at any time in your html code with the action event name.

    onBlur="doSubmit('eventSubmit_doYourMethodName)" 

This will result in a call to doYourMethodName method in the ActionEvent class.

Turbine2/UsersGuide/ActionEvents (last edited 2009-09-20 22:00:12 by localhost)