...
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.
...
- put a hidden element in the form:
No Format |
---|
<input type="hidden" name="actionevent" value=''''''> |
- wrap the form.submit() in a js function that changes the actionevent name
Code Block | ||||
---|---|---|---|---|
| ||||
No Format | ||||
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.
No Format |
---|
onBlur="doSubmit('eventSubmit_doYourMethodName)" |
This will result in a call to doYourMethodName method in the ActionEvent class.
Example
Find an usage example in org.apache.turbine.modules.actions.VelocityAction in Turbine Code.