-
Not necessary, but it would be nice -
I have a submission form AddDailyRept.asp that has 10 textbox controls on a form. The form is declared
Code:
<form action="DailyReportConfirmation.asp" method="post" id="frmSubmit">
The information is submitted to DailyReportConfirmation.asp and then processed. I would like for the user to be able to navigate the fields with the Enter key and only submit the information when they press Enter when the last field has the focus. As of right now, the Enter key submits the form no matter which control has the focus. I have this code for each text box:
Code:
<SCRIPT LANGUAGE="VBScript">
<!-- hide language from older browsers that don't recognize the SCRIPT tag
Public TheForm
On Error Resume Next
Sub cmbFacility_OnKeyPress
Dim KeyPressed
Set TheForm = Document.forms("frmSubmit")
KeyPressed=Window.Event.KeyCode
If KeyPressed = 13 Then 'sends focus to next control.
TheForm.TheDate.Focus()
End If
End Sub
but that gets overridden. Is there any way to do this?
-
well one way to go about is
<INPUT TYPE=button VALUE="Submit" onclick="yourfunction()" id=button1 name=button1>
onsubmit call a function yourfunction() and in this function check if the focus was in the last input...if so submit..else don't...this way u can avoid the use of cmbFacility_OnKeyPress in all the inputs...
Sonia