Kshirod
Zip Code Validation
2 Answer(s)      4 years and 6 months ago
Posted in : Java Interview Questions

View Answers

November 27, 2008 at 11:32 PM


Hi friend,

Code for Validate Zip code of 6 digits using Javascript.

<script language="javascript" type="text/javascript">
function validateZIP() {
if(document.zipForm.zip.value!="")
{

if(document.zipForm.zip.value.length!=6)
{
alert("Please enter zip code of 6 digit.");
document.zipForm.zip.focus();
return false;
}
else if(isNaN(document.zipForm.zip.value))
{
alert("Please enter valid digit 0-9.");
document.zipForm.zip.focus();
return false;
}

return true ;

}
}


</script>
<form name="zipForm" onSubmit="return validateZIP();">
Zip: <input type=text size=30 name=zip>
<input type=submit value="Submit">
</form>


For more information,Examples and Tutorials on Javscript visit to :

http://www.roseindia.net/javascript/

Thanks

November 27, 2008 at 11:54 PM


Date Validation (From and To)

Html code :

<form name="cashForm" method="post" action="viewTransaction.jsp" onsubmit="return validate();">
<table width="350px" align="center" border=0 style="background-color:ffeeff">
<tr>
<td colspan=2 align="center" style="font-weight:bold;font-size:20pt;">View Transaction</td>

</tr>
<tr>
<td colspan=2>&nbsp;</td>

</tr>



<tr>
<td>Start Date</td>
<td><input type="sdate" name="sdate" id="sdate"><a href="javascript:NewCal('sdate','mmddyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a></td>
</tr>

<tr>
<td>End Date</td>
<td><input type="edate" name="edate" id="edate"><a href="javascript:NewCal('edate','mmddyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a></td>
</tr>

<tr>
<td></td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>

---------------
Javascript code :

<script language="JavaScript">
<!--
if (document.images)
{
calimg= new Image(16,16);
calimg.src="images/cal.gif";
}
function validate()
{
var fromDate = "2008-11-28";
var toDate = "2008-11-27";


var sdate = fromDate.split("-");
//alert(sdate.length);
var edate = toDate.split("-");
//alert(edate.length);
if(sdate[0]>edate[0])
{
alert("Start date not greater then end Date.");
document.cashForm.edate.focus();
return false;
}
else if(sdate[1]>edate[1])
{
alert("Start date not greater then end Date.");
document.cashForm.edate.focus();
return false;
}
else if(sdate[2]>edate[2])
{
alert("Start date not greater then end Date.");
document.cashForm.edate.focus();
return false;
}
//return false;

}
//-->
</script>

Thanks









Related Pages:
Zip Code Validation - Java Interview Questions
Zip Code Validation  Hi, Anyone can please send me a javascript function of the following --> Indian postal Zip Code Validation (Only 6 digits... should not be greater than to date  Hi friend, Code for Validate Zip
JavaScript regex validate validate Zip.
- how to validate Zip?   <html> <head> <title>Zip Code...)) { alert("Your Zip Code : "+zip); return true; } alert("It is not valid zip code !"); return false; } <
schedule zip
schedule zip  Java Code to automatically get and zip only .txt files from folders for every 5 days and also to send the zip files to database tables
validation
validation  we are doing payroll system project in java.So pls provide the complete validation code for employee master form
validation.....
validation.....  hi.......... thanks for ur reply for validation code. but i want a very simple code in java swings where user is allowed to enter only numerical values in textbox , if he enters string values then it should
validation
it goes to another folder.) this is my code i used this method... Validation method valid the in put. otherwise call the javascript onsubmit to check... code.Ok if you use struts then you can use Validation method valid the in put
validation
validation  please help me to check validation for <form> <table class="form"> <tr> <td class...; in this code i have to get error when sno,date,custmername,contactno
validation
validation  when user enter course to follow,should have pre requirements. This is my code if(document.application1.courseCode1.value ==1) { frmvalidator.addValidation("subject1","shouldselchk=biology","Should
Validation
Validation  Here is my form and what code should i write for validating it? - <form action="test4.jsp"> <ul> <b>User ID</b> :<input type="text" name="userid">
Validation
Validation  Here is my form and what code should i write for validating it? - <form action="test4.jsp"> <ul> <b>User ID</b> :<input type="text" name="userid">
Javascript validation - Java Beginners
for the validation of Zip code,the problem is, when user enters the valid zip code... want that if user enters the valid zip code in first attempt then text box's... background color should change to red and then on entering valid zip code
Encode 5 digit zip code - Java Beginners
Encode 5 digit zip code  I have an assignment to read in a 5 digit zip code, sum the digits, and come up with the check digit. I then need... as well as a | at the beginning and a | at the end. For example, the zip code 95014
convert a file .doc to .zip
with extension .doc now i required with .zip   Hi Friend, Try the following code... + ".zip"; byte[] buffer = new byte[18024]; try{ ZipOutputStream zos...   Hi Friend, Try the following code: 1)page.jsp: <%@ page
zip file upload in php - WebSevices
zip file upload in php  This is not a normal upload. we know the code for normal upload. i need the zip file upload code in php. how to upload zipfile using php? and how to unzip using php? please i dont
Java file zip
Java file zip In this section, you will learn how to create a zip file. The ZIP file format is used for the distribution and storage of files. It is a compressed format file which takes less space then the original file. The zip file
Javascript validation code
Javascript validation code  Hi, I need a javascript validation code for the following fields 1)Name 2)Email 3)Mobile 4)City 5)State 6)Product type 7...,email required etc) Kindly please send me the code as soon as possible
Javascript validation code
Javascript validation code  Hi, I need a javascript validation code for the following fields 1)Name 2)Email 3)Mobile 4)City 5)State 6)Product type 7.....it should display enter the field required Kindly please send me the code
How to generate hash code of Zip file.
How to generate hash code of Zip file. In this tutorial, we will see how to generate hash code of zip file entries. The ZipFile   class is used to read... HashCode Of Zip File : 1455566828 Download this code
Unzip a ZIP File
and stored in the zip file. Here is the code of the program... Unzip a ZIP File       How to unzip (extract) a zip file? How to retrieve elements from
Matching Zip code using regular expression
Matching Zip code using regular expression  ...;:-This is the regular expression use to match with Zip code. matchZip("45643-44435"):-Defining Zip code which is to be matched with the regular expression Matching
Creating a ZIP file in Java
archive the file from the zip file by extracting, if you want. Code Description... Creating a ZIP file in Java       Zip File: Zip file format is the popular method
Listing Contents of a ZIP File
of a zip file through the java code. Following program helps you for the appropriate... directory. Then it shows the list of the elements of the zip file. Code Description... to read the zip file entries. Here is the code of the program
Create zip file in Java
Create zip file in Java       Introduction In this section, you will know about a zip file. You will also learn how to create a zip file from any file through the java
How to make a zip file in java
zip file. Code: import java.io.*; import java.util.zip....Description: In this example we will discuss about how to create zip file from...;} } Output: When you compile and run this program it will create the zip
How to extract zip file in java.
How to extract zip file in java. In this Example, we will discuss how to extract a ZIP file. We will use ZipInputStream class for creating input stream that take input from ZIP file. The ZipInputStream class is available
How to create a zip file and how to compare zip size with normal text file
How to create a zip file and how to compare zip size with normal text file  Hi, how are you?I hope you are fine.I want program like how to create zip file based on one text file.i saw the code in the below link which was provided
date validation
date validation  sir, pls provide date validation code in javascript..we want to include it into our master form..   Please visit the following link: http://www.roseindia.net/mysql/datevalidation.shtml
Show all the entries of zip file.
Show all the entries of zip file. In this tutorial, We will  discuss how to show all the entries of a zip file.  The ZipFile   class is used to read entries of zip files. The entries() methods of ZipFile class 
Validation code - Java Interview Questions
Validation code  Hi, Anyone can please send me a javascript function for password filed validation (the field will only take characters as input not other). Thanx in advance  Hi friend, code to solve the problem
Validation doubt
Validation doubt  hi..... thanks for the other validation code. I have got that and implemented in my code but i have a doubt in that. As we try... be done ? what change in the code should be made plz help.............. i
Java zip package - Learn how to use java zip package.
Java zip package In this section we will learn about java.util.zip package of java library. We will also learn how to use the zip API to create and read the zip and gzip files within java program. The zip format is very easy method
Java Util Zip. Zip files/folders inside a folder, without zipping the original source folder.
Java Util Zip. Zip files/folders inside a folder, without zipping the original...) throws Exception { ZipOutputStream zip = null; FileOutputStream fileWriter = null; fileWriter = new FileOutputStream(destZipFile); zip = new
Zip File Using Java
; This example shows how to create a zip file in java. In other words, we... but the zip (compress or decompress )tools. Examples of zip tools are Winrar, WinZip etc. It is also possible to zip and unzip the files from your Java
combox validation javascript code - JSP-Servlet
combox validation javascript code  hiiiiiii, I want a javascript code for combobox field validation for my Lotus Notes web page.... thnx  Hi This is the source code of combobox validation in javascript
javascript validation
javascript validation  my problem is following code is my form i want validation and for email field it will check formate useing regularexpressions...;html    Email Validation function checkEmail
String Validation
String Validation changing password  Hi. I have a HTML coding in that I have to check whether the value given in the 2 password fields are same... a message.   Here is a code that accepts the current password, New
form validation
want validation code,username minimum 8 char,password length must >6,and one
Email Validation code - Java Interview Questions
Email Validation code  Can anybody tell me how to write email validation code using java   Hi Friend, Please visit the following link: http://www.roseindia.net/tutorial/java/core/regularExpressions.html Thanks
jsp validation
jsp validation  enter name-___ enter number-__ I want that the focus should not go to number till the time u have entered name. Means the number text should be disabled.. i require code
Form validation
Form validation  Hi Everyone Can someone assist me with a complete code to validate a form. e.g where the user must insert an ID number it should... be a dynamic function code e.g validate.js that I can link it to my jsp page. Your
javascript validation
button.. please send me the code for this as i am new to the dot net field
Time validation
project.   Here is a code that accepts the time in the format hh:mm
user validation
user validation  i hv just started with my lessons in jsp n also doin my final yr project in jsp.i m doin the login page & m stuck with a problem in validating the user.the code i hv written below doesnt redirect to the login
String Validation
;Here is a code that accepts the current password, New password and conform
String Validation
;Here is a code that accepts the current password, New password and conform
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
Password validation
is a code that accepts the current password, New password and conform password from

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.