Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Answers Viewqa Java-Beginners validation in java script

Have Programming Question? Ask it here!

validation in java script
1 Answer(s)      2 years and a month ago
Posted in : Java Beginners

i have put this code for only entering integer value in text box however error occured.. if(document.formname.textbox1.value!=="") { var rn,i;

rn=document.formname.textbox1.value; for(i=0i='0' && rn.charAt(i)<='9') { } else { alert("code must be an integer"); return false; } this is not working properly pls help

View Answers

July 26, 2012 at 4:47 PM

Here is a javascript code that validate s the number.


function validate(){

     if(document.form.num.value == ""){
        alert("Please enter number!" );
        return false;
        var con=document.form.num.value;
        var ex = new RegExp(/^\d+$/);
        var t=ex.test(con);
        alert("Enter only Number .");
        return false;
<form name="form" method="post" onsubmit="return validate();">
 Enter Number: <input type="text" name="num">
               <input type="submit" value="Check">

Related Tutorials/Questions & Answers:
java script validation - Java Beginners
java script validation  hi, i have two radio buttons yea and no. all text fiels r deactivated, when i click no radio button. its get active... Button Validation function callEvent1
java script validation - Java Beginners
java script validation  how to do validations in j s p thru java script  Hi friend, Code to create a jsp page "contact.jsp" with javascript validation : Contact Details .txt { font-size:12px; font
please send me java script for html validation - Java Beginners
please send me java script for html validation  please send me code for javascript validation .........please send me its urgent a.first:link { color: green;text-decoration:none; } a.first:visited{color:green;text
Form Validation With Java Script
Form Validation With Java Script   ... the Validation in  JavaScript and  your Validation in JavaScript program. JavaScript  Java script is used to validate forms, that means checking the proper
Java script
Java script  Source code for capturing the screen using Java Script
Java Script
Java Script  why we are using java script
java script
java script  how to write a Java script program to enter number in two text fields and then automatically display the total in another text field
Java script
Java script  a java script code for accept 10 numbers from the user and print in the descending order without using sort method
Java Script
Java Script  I want to display an error message for the validation of email at the top of the page in red font i want to use java scripts but i dont want to use alert box what i need to do   <html> <script>
java script
java script  how will you identify whether the number entered by the user has two digits or three digits.Assuming that the user enters only a three digit or two digit number.   <HTML> <HEAD> <SCRIPT
java script
java script  write a java script code which provide a menu for user which will enable him/her to either add or subtract or multiply or divide two numbers and produce the corresponding result.   <html> <
java script
java script  when you click a button how will you change the background color of a web page
java script
java script  hi deepak, i have small doubt in the date ranges that when i select the date range then it display on the text boxes. example:suppose i select the weekly date range then the dates are display on the text boxes up
How to use email validation check through java script in jsp page
How to use email validation check through java script in jsp page...; This is detailed java code that explains how to use java script validator in jsp page... valid email using java script. */ function emailCheck(str) { var
defining numbers in Java Script
defining numbers in Java Script  Explain about defining numbers in Java Script
Sitemap Java Script Tutorial
| Email validation is JSP using JavaScript | Java Script Code of Calendar... | Conditions In Java Script | Looping in JavaScript | Functions in JavaScript... Application With Ant and Deploying on Jboss 3.0 | J2EE Tutorial - Java Bean
Java Script location.replace method
Java Script location.replace method  Hi, What does `Print `{<SCRIPT LANGUAGE="JavaScript"> location.replace("} & urlpop & {","BOTTOM") </SCRIPT>} this mean as this is written in an Lotus Script agent and I
validation on dates - Java Beginners
validation on dates  how to find difference in days between two dates in java.  Hi Friend, Please visit the following link: Thanks
java script - Development process
java script  how could i devlop code for create widget. i need to generate java script that if paste to any other web site will generate the widget. a widget can contain image text video or combination
qunit jquery with java script
qunit jquery with java script  hi deepak How to write a javascript code and do the test by using qunit sample application and as I am new to testing how to setup the environment for java script testing? where should I run
java script - Ajax
java script  i know basic of java script. i want to gain more knowledge in java script. please send a link or guidelines to me. and ajax also my mail address is  Hi friend, Javascript
java script - Ajax
java script  I have a java script function and getting "pitems" list values in select, and i want to send the values in the form of List to my CommonService class. Below code is not working... function f_getPop
Java script - Development process
Java script  Dear Sir/Mdm I have a probem, when any user close the browser without logout at that moment the user should be logout, I wrote some java script code for that its working in IE not Fire Fox, actually
java script - Development process
java script  hi.. how to get previous and next buttons inside the table in the same page as like our mails in the inbox.  Hi Friend, Try the following code: ID Name Address Contact
java script - Struts
java script  how validation for date is performed in the top-down select.if the user clicks submit without selecting the date, month and year. what is the validation for selecting a date that is in future like jul 2009
script error - Java Beginners
script error  hi, Is it possiple to use PHP function under the script tag. plz help me. thank u in advance. regards, sakthi  Hi Friend, Yes It is possible to use PHP function under the script Tag. Thanks
java script - Java Beginners
java script  how to get the variable value declared in javascript to the scriptlet of a jsp without using form  Hi Friend, Try it: function hello(){ var myvar=document.getElementById("text").value
java script - Java Beginners
java script  hi sir, the program code that i need for is : 1)there are two button in javascripting if you click the Ok button the cancel should disappear .  Hi Friend, Try the following code: function
java script - Java Beginners
java script  within a itself can i call a function into another function such like performing inner class or calling a method into other method and process it also  Hi Friend, Try the following code
java script - Ajax
java script  I have a java script function and getting "pitems" list values in select, and i want to send the values in the form of List to my CommonService class. I want to display the selected value from the select box
java script - JSP-Servlet
java script  what is the use of hidden fields in java script? if a page has 3 links the first link should be enabled and others should be disabled. once the form inside the first link is filled and submitted the next link should
java script and velidatores - Security
java script and velidatores  i made a job portal and in it many fields which required validate how i do throw java script.. can you help me please send me common validate function which used in any site.....   Hi
script problem - Java Beginners
script problem  Even though both .js file and .jsp file present in the same location,script is not working in mozilla but working in Internet... what i have written present in same location. but the script
java script code
java script code  Hi Deepak, Firstly wanna share the problem em facing: working with servlet and jsp for my project. I have 3 main jsp pages which interacts with user for accepting user input and supply them
script code - Java Beginners
script code  hi, thanks for ur fast reply. plzz, give me a sample code for PHP function under script tag. regards, sakthi  Hi friend, Code to help in solving the problem : Hello PHP World
java script text box
java script text box  hi, I created a button when i click on button(next/prev) new two textbox is created. i want to do the two textbox will show by next and prev button. when i click the next button only two textbox show
java script - JSP-Servlet
java script add items  How to add items in an array in JavaScript... in javascript</title><script type="text/javascript" src="mtmcode.js"></script><script type="text/javascript">
form values in java script - Struts
form values in java script  how to get form values in java script functions with struts1.1
java script - Development process
java script  hi.. i need a table formate list of customers from the back end which will not more than 8 customers, the other customers in the backend can be viewed by next previous buttons into the same table.which is the same
Java Script - JSP-Servlet
Java Script  I can't find any tutorial on JavaScript. Please help me out  Hi Friend, Please visit the following link: Thanks  Hi Friend, Go to this link here you
java script - JSP-Servlet
java script  How to open a form while clicking a image button?  Hi Friend, You can use the following codes: 1) 'ImageButton.html' Click the Image Button 2) 'form.html' Form First Name
java script - JSP-Servlet
java script  hello buddy......i m new to here....please help me to solve my problem i have a jsp page with pre populated value comming from other jsp.....ones i submitted i have to clear that page and i have to submite
document.cookie() in Java Script
document.cookie() in Java Script  Can you give me a simple program to set Cookie in a JSP Program using Javascript . . . and about "Argument of document.cookie() method" ........... Thamks in Advance . . .   Please
selectoptions errors in java script
selectoptions errors in java script  hi, in my web page when I select the color of the image it displays that particular color but when i again opt the select option it displays errors message. How do I rectify this problem
java script,java - Java Beginners
java script,java  hi deepak i have one image is there.beside the image ihave 11 digital numbers is there.that digital numbers we can drag and drop the image when we drop the digitan we can one display box will displayed
validation  validation
Java Script - Ajax
Java Script  Hi Sir, This is mohan. I am sending the code regarding what i needed. In the code There is 1."Type" which is the combo box through which the details can be fetched from the Database. and in the same line
java script - Development process
java script  Hi guys, can anybody tell me how to create menu box using DHTML i want source code please help me its very urgent  Hi Friend, Try the following code: 1)menu.html: #layer1
Java Script - JSP-Servlet
Java Script  hi, im having a problem in updating the cart. below is the code for that. what i want is i need to enter the how much quantity by entering in the textbox and when i click on the update cart i need to display
Validation in swing - Java Beginners
Validation in swing  I want to validate my swing program. If I didnt enter the field in text box a msgbox should have to appear that enter all the fields.  Hi Friend, Try the following code: import java.awt.