|
⇤ ← Revision 1 as of 2005-03-22 05:44:02
Size: 1311
Comment: missing edit-log entry for this revision
|
← Revision 2 as of 2009-09-20 23:50:07 ⇥
Size: 1313
Comment: converted to 1.6 markup
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| 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-2.2.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 ActionEvent 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-2.2.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 ActionEvent 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 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.