Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

clear textbox after validation?

Posted on 2006-07-20
2
Medium Priority
?
216 Views
Last Modified: 2012-06-22
this will validate my rows, but how can i instead of selecting the entry clear the field instead?


function validate(field) {
var iRow = "0123456789"
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (iRow.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Invalid entry! Only numeric values allowed");
field.focus();
field.select();

}
}
0
Comment
Question by:Padre_Corleone
2 Comments
 
LVL 37

Accepted Solution

by:
Harisha M G earned 2000 total points
ID: 17149765
Hi,

field.clear();

or

field.value = "";



---
Harish
0
 
LVL 7

Author Comment

by:Padre_Corleone
ID: 17149824
i used

field.value ="";

Thanks so mucho.

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one 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…

879 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