I've created a component that captures function keys (IE only, it
appears) and then executes javascript.  (With thanks to David McTavish
for the tag syntax).

However, what I'd really like to do is have it behave like a UICommand
component and support action, actionListener, immediate, etc.

What's the best way to do this?  I made keyCombination extend
UICommand, so the API should be in place, but how, when I'm processing
onKeyDown.decode(), can I get it to queue up the appropriate event?

The one idea that comes to mind is to render hidden HtmlCommandButtons
(buttonFxx) or HtmlCommandLinks for each keyCombination and then
suffix the javascript with "buttonFxx.click()".

It seems like there should be a better way to determine the event
processed and then queue the event, but from what I can tell, the
inner workings to do this for the html renderkit all require internal
knowledge of the JSF implementation in order to set the command on the
form.

Maybe I'm reading more into UICommand processing than is required and
it's simply a matter of picking a form parameter name and stuffing the
name of the key pressed into it, then doing the right thing on decode
based on the key value.

        <onKeyDown>
                <keyCombination key="F1"
                        onKeyPress="alert('test F1');" />
                <keyCombination key="F2"
                        onKeyPress="alert('test F2');" />
                <keyCombination key="F3"
                        onKeyPress="alert('test F3');" />
                <keyCombination key="F5"
                        onKeyPress="alert('test F5');" />
        </onKeyDown>

Reply via email to