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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

keyPressed trap

Status
Not open for further replies.

jefargrafx

Instructor
May 24, 2001
273
US
how do you trap a key from performing it's action.

I have several fields on a form and I do not want the user to delete the field contents and process the form again.

if you delete the contents, and process the form serveal of my fields display NaN, I'll need to trap Delete, Space and Backspace...or in other words my textfield must contain numbers?

any ideas jef
 
Why not just insert some validation, instead of trapping keys? It'd be pretty useless trapping Delete and Backspace ... what happens if the user makes a mistake?!

Before the form is submitted, run each of the values through a validation function which checks to see if all values are numbers. If they are, submit the form. If not, point out the offenders and ask the user to rectify the mistake(s).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top