Solved

How to envoke the BackSpace event in Javascript

Posted on 2006-07-05
7
503 Views
Last Modified: 2012-08-14
I have a texbox in my asp page. When the user enter some non-numerical value, it will pop up a message,

"Please Enter only Numbers".  Along with this message, I want to delete the non-numerical character entered by the user. In VB I use Sendkeys + {BACKSPACE}. When I give this command, it sends a backspace .

I want a similar option in Javascript. Any idea???
0
Comment
Question by:CWS (haripriya)
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 17041594
No. However you can cancel the event or chop the field to value.length-1

Michel
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 17041613
0
 
LVL 7

Expert Comment

by:ljubiccica
ID: 17041714
Hey!

Well you probably have some function that checks the data given and then shout out some alert message???

In this case you can do something like this:

<script language="javascript">
function alert(){
alert('Enter the real stuff');
resetData();
}

function resetData(){
document.myinput.reset();
}
</script>

where the input you want clear must have the name you specified in document.myinput.reset();
(in this case you would have <input name="myinput">

Hope this is what you needed...

Ljubiccica
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 17041768
@Ljubiccica - welcome to EE.
A few things:

There is no reset on field level...
Also you cannot access a field via document.fieldName
Please do not confuse people...
0
 
LVL 7

Expert Comment

by:ljubiccica
ID: 17041861
OK, i'm sorry...

i should have asked first where does cyberwebservice want to reset things...

i thought he wants to reset <input type="checkbox"> thing...

Sorry once again

Ljubiccica
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 17042235
That is ok, however the code you proposed is not doing anything on any browsers regardless of what he wanted...
0
 
LVL 16

Author Comment

by:CWS (haripriya)
ID: 17200359
Sorry guys, no time for me to test your suggestions. I was tied up with other projects which doesnot use Javascript. I need some more time.

I just want to add coments to avoid this questions to get abondend.

I will check and get back to you soon.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to filter by key press ? 6 57
Asp response.write to clients 6 34
Use "if not" in a condition 2 19
Can I use php variable in jquery 8 21
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question