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:
<input type="hidden" name="actionevent" value=''''''> |
doSubmit(actionevent_name){ document.formname.actionevent.name=actionevent_name; document.formname.submit(); } |
onBlur="doSubmit('eventSubmit_doYourMethodName)" |
This will result in a call to doYourMethodName method in the ActionEvent class.