adamdavies
Programmer
what i have is a number of textboxes on my form.
I want first textbox to recieve the focus.
When i scan a barcode, it enters the text into the textbox and then focus goes to the next textbox.
The scanner has an carriage return at the end, so i dont want it to submit my button but go to next textbox.
I have a submit button.
I only want this to be clicked when the user actually clicks the button.
This will then update my database embedded SQL with the text from all the textboxes.
I AM USING
Private Sub SetFocus(ByVal ctrl As System.Web.UI.Control)
Dim s As String = "<SCRIPT language='javascript'>document.getElementById('" & ctrl.ID & "').focus() </SCRIPT>" RegisterStartupScript("focus", s)
End Sub
'SET FOCUS TO FIRST TEXTBOX
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strJScript As String
strJScript = "<script language='javascript'>document.Form1.PalletNumTxt.focus();</script>"
Page.RegisterStartupScript("focusScript", strJScript)
End Sub
'NEXT TEXTBOX AND SO ON
Private Sub PalletTagTxt_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PalletTagTxt.TextChanged
Me.SetFocus(Me.PalletStartTxt)
End Sub
It doesnt work when i change button type from
<input type="submit"
to
<input type="button"
thanks
adam
I want first textbox to recieve the focus.
When i scan a barcode, it enters the text into the textbox and then focus goes to the next textbox.
The scanner has an carriage return at the end, so i dont want it to submit my button but go to next textbox.
I have a submit button.
I only want this to be clicked when the user actually clicks the button.
This will then update my database embedded SQL with the text from all the textboxes.
I AM USING
Private Sub SetFocus(ByVal ctrl As System.Web.UI.Control)
Dim s As String = "<SCRIPT language='javascript'>document.getElementById('" & ctrl.ID & "').focus() </SCRIPT>" RegisterStartupScript("focus", s)
End Sub
'SET FOCUS TO FIRST TEXTBOX
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strJScript As String
strJScript = "<script language='javascript'>document.Form1.PalletNumTxt.focus();</script>"
Page.RegisterStartupScript("focusScript", strJScript)
End Sub
'NEXT TEXTBOX AND SO ON
Private Sub PalletTagTxt_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PalletTagTxt.TextChanged
Me.SetFocus(Me.PalletStartTxt)
End Sub
It doesnt work when i change button type from
<input type="submit"
to
<input type="button"
thanks
adam