Microsoft KB Archive/292760

= FP2000: Pressing ENTER on a Form Page Submits the Form =

Article ID: 292760

Article Last Modified on 6/18/2005

-

APPLIES TO


 * Microsoft FrontPage 2000 Standard Edition

-



This article was previously published under Q292760



For a Microsoft FrontPage 2002 version of this article, see 302905.



SYMPTOMS
When entering information in a form on a Web page, pressing ENTER on the keyboard submits the form rather than moving the insertion point to the next form field.



CAUSE
The default behavior for a Web browser is to submit the form when you press ENTER.



WORKAROUND
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. NOTE: You may receive an error message if you copy the examples directly from this article and paste them into FrontPage. The angle brackets may appear as escaped HTML code. To work around this behavior, paste the script into a blank Notepad document, and then copy it from Notepad before you paste it into FrontPage.

IMPORTANT NOTE: The following sample code uses custom DHTML that may not be available in all browsers. For more information about compatibility with other browsers, click Microsoft FrontPage Help on the Help menu, type compatibility in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

To work around this behavior, use Dynamic HTML (DHTML) to intercept the ENTER keystroke and convert it to a TAB keystroke.  Open a Web in FrontPage 2000 and create a new page. Insert a form on the page:  On the Insert menu, point to Form, and then click Form. Right-click the form and then click Form Properties on the menu that appears. In the Form Name box, type myForm . Click OK.</li></ol> </li> Add two text boxes to the form: <ol style="list-style-type: lower-alpha;"> On the Insert menu, point to Form, and then click One-Line Text Box.</li> Press ENTER.</li> On the Insert menu, point to Form, and then click One-Line Text Box.</li></ol> </li> Delete the Submit and Reset buttons.</li> Switch to HTML view and make the following changes: <ol style="list-style-type: lower-alpha;">  Locate the   tag and change it to the following: <body onContextMenu=&quot;return false&quot; onKeyDown=&quot;if (window.event.keyCode==13) window.event.keyCode=9;&quot;> </li>  Locate the   tag and change it to the following: <input onKeyDown=&quot;if (window.event.keyCode==13) myForm.submit;&quot; type=&quot;submit&quot; value=&quot;Submit&quot;>

<input onKeyDown=&quot;if (window.event.keyCode==13) resetForm;&quot; onClick=&quot;resetForm;&quot; type=&quot;button&quot; value=&quot;Reset&quot;>

<script language=&quot;JavaScript&quot;>

</li></ol> </li> Save the page as Formtest.htm in your Web.</li></ol>

When you view this page in Microsoft Internet Explorer, and press ENTER, it will be captured and converted to a TAB keystroke unless the ENTER key is pressed when either the SUBMIT or RESET buttons have focus.

Additional query words: front page

Keywords: kbprb KB292760

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.