IF event_id = CL_HTMLB_MANAGER=>EVENT_ID.
DATA: event_data TYPE REF TO IF_HTMLB_DATA.
event_data = CL_HTMLB_MANAGER=>get_event_ex( request ).
if event_data->event_defined = 'input1'.
endif.
if event_data->event_defined = 'input2'.
endif.
ENDIF.
You can also use this to create custom input field help. Key press events for other function keys can also be captured. You can get keycodes of all keys from the below link. Just replace the keycode in the application.
Keycodes
Summary :
I have mentioned a way to capture F4 key pressed event in html and htmlb input elements using javascript validations.