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



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


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



Advertisement
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 Tutorials/Questions & Answers:
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
Zip Code
Zip Code   I have 4 excel file and i want to zip that files also i need password protect when i open that file please write that code for local machine also write in using javascript
Advertisements
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
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
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
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
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
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
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
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
validation
validation  we are doing payroll system project in java.So pls provide the complete validation code for employee master form
validation
validation  validation
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
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
Please provide jquery inline form validation for the code
Please provide jquery inline form validation for the code   <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Student Form</title> <script type
Two Dates code validation - Date Calendar
Two Dates code validation  Hi Sir.I am using calender for two text... should be greater than date of birth.plz help me in code .  Hi Friend, Try the following code: function check(objName) { var datefield
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
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
); JLabel label=new JLabel("JTable validation Example",JLabel.CENTER); JPanel panel=new JPanel(); panel.add(scroll); JFrame frame=new JFrame("JTable validation
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">
Read a zip file.
zip_entry_read() In this example the function zip_entry_read() will help in reading a zip file. First select a file to be opened. Name that file into zip file and direct the zipread command to read it through while loop. The zip_entry
how to write a code for oracle database connection in asp.net for validation.
how to write a code for oracle database connection in asp.net for validation.  <script language="javascript" type="text/javascript"> function fill() { //<%@ import Namespace="System.Data" %> //<%@ import
please send me javascript validation code - Java Beginners
please send me javascript validation code  hallo sir , please send me java script code for this html page.since i want to do validation.i am a new user in java ....please send me its urgent
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
sending a zip file to servlet
sending a zip file to servlet  I have created a .zip file in a servlet on the local system(no static ip). The .zip file contains xml files. I have to send it to another servlet which is in a server(has a static ip). I have done
Advertisements
 

 

 

DMCA.com