I have a tag that generates java script.  Below is the relevant code from
the tag

            out.println("");
            out.println("<!-- Map Enter Key - BEGIN -->");
            out.println("<SCRIPT LANGUAGE=\"JavaScript\">");
            out.println("<!--");
            out.println("  function getKey(keyStroke) {");
            out.println("    isNetscape=(document.layers);");
            out.println("    eventChooser = (isNetscape) ? keyStroke.which :
event.keyCode;");
            out.println("    if (eventChooser == 13) {");
            out.println("      window.location=\"" + location + "\";");
            out.println("    }");
            out.println("  }");
            out.println("  document.onkeypress = getKey;");
            out.println("-->");
            out.println("</script>");
            out.println("<!-- Map Enter Key - END -->");
            out.println("");

To use the code/tag in the jsp I simply type

        <ccom:MapEnterKey location="javascript:submitForm()"/>

Hope this helps.


-----Original Message-----
From: James Mitchell [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 07, 2002 10:33 AM
To: Struts Users Mailing List
Subject: RE: Default Button


There is no default.

When the user hits enter in any input field (except textarea) the enclosing
form is submitted.

JM




> -----Original Message-----
> From: IS Struts [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 07, 2002 10:26 AM
> To: [EMAIL PROTECTED]
> Subject: Default Button
>
>
> How do you make a button a default button on a JSP, so when the
> user hits the 'Enter' key the button is submitted?
>
> Any suggestions are appreciated,
> Rich
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to