Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On Text Change - DO STUFF

Status
Not open for further replies.

tqeonline

MIS
Oct 5, 2009
304
0
0
US
Hello All,

I have two text boxes:
1. txtEmployeeID
2. txtDeviceID

The application will use a barcode scanner and depending on which item is scanned I want it to populate correctly.

Example: say that the txtDeviceID is highlight and an employee scans their badge, the first letter is an "E" so I want the textbox to be smart and detect that first letter and populate the correct box. So it would take the input from the DeviceID and populate the EmployeeID with it, then clear out the DeviceID and set the focus to the Device ID.

I figured the best way to do this is javascript... but i know nothing about Javascript :)

Any pointerS?

- Matt

"If I must boast, I will boast of the things that show my weakness"

- Windows 2003 Server, 98 SE, XP
- VB.NET, VSTS 2010, ASP.NET, EXCEL VBA, ACCESS, SQL 2008
 
Hi

Matt said:
I figured the best way to do this is javascript...
As you can never trust the client side, you must validate it with server-side code too.

Unless there are more client-side actions to be performed before submitting the [tt]form[/tt], I would choose a user-friendlier[sup](*)[/sup] way : a single [tt]input[/tt] where any[sup](**)[/sup] of those two barcode types can be entered.

[small](*) At least for me. YMMV.[/small]
[small](**) Or maybe even both, separated with space, comma, whatever.[/small]


Feherke.
 
Well the way I want it to work, where i need guidance, is this is going to be a barcode scanner scanning in an ID.

If the text scanned starts with an E and its not the employee text box I want it to populate the employee text box then set focus to the Device text box.

Ex. focus is in the Device ID textbox and I scan my badge "E1234" I want their to be logic in that box that says

Code:
if left(txtDeviceID,1) = "E" then
txtEmployeeID.text = txtDeviceID.text
txtDeviceID.text = ""
txtDeviceID.setfocus
End if

But I can't get this to function right in ASP.net and I don't know Javascript that well.

- Matt

"If I must boast, I will boast of the things that show my weakness"

- Windows 2003 Server, 98 SE, XP
- VB.NET, VSTS 2010, ASP.NET, EXCEL VBA, ACCESS, SQL 2008
 
correction:
Code:
if ucase(left(txtDeviceID.text,1)) = "E" then

- Matt

"If I must boast, I will boast of the things that show my weakness"

- Windows 2003 Server, 98 SE, XP
- VB.NET, VSTS 2010, ASP.NET, EXCEL VBA, ACCESS, SQL 2008
 
Hi

The exact translation of your code :
JavaScript:
if (txtDeviceID.value[0].toUpperCase() == 'E') {
  txtEmployeeID.value = txtDeviceID.value
  txtDeviceID.value = ''
  txtDeviceID.focus()
}
Note that I have no idea how ASP would know what txtDeviceID and txtEmployeeID are.


Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top