Using java script do login form having fields with condition.

Ads
 

Using java script do login form having fields with condition.

Need a login form with username, password, phone no, email id, date fields. We should specify the conditions for each field and if we press the submit button conditions of each field should appear. ex :*First name cannot be empty

Last Name cannot be empty

Email id cannot be empty

Password Cannot Be Empty

Conform Password cannot be empty

Phone Number Should Not Be Blank

if we given first name then first name cannot be empty should removed.

The submission should be uneven may be we can give date as first field and press submit submit button. I need this requirement pls help me out. thanx for answer

View Answers

June 20, 2011 at 5:34 PM

<html>
<script>
function validate(){
    if(document.form.fname.value == ""){
        alert( "First Name cannot be empty" );
        document.form.fname.focus();
        return false;
    }
    if(document.form.lname.value == ""){
        alert( "Last Name cannot be empty" );
        document.form.lname.focus();
        return false;
    }
    if(document.form.email.value == ""){
        alert( "Email cannot be empty" );
        document.form.email.focus();
        return false;
    }
    if(document.form.pass.value == ""){
        alert( "Password cannot be empty" );
        document.form.pass.focus();
        return false;
    }
    if(document.form.cpass.value == ""){
        alert( "Confirm Password cannot be empty" );
        document.form.cpass.focus();
        return false;
    }
    if(document.form.phone.value == ""){
        alert( "Phone Number cannot be empty" );
        document.form.phone.focus();
        return false;
    }
    return true;     
   }  
</script>
<form name="form" method="post" onsubmit="return validate();">
<table>
<tr><td>Enter First Name</td><td><input type="text" name="fname"></td></tr>
<tr><td>Enter Last Name</td><td><input type="text" name="lname"></td></tr>
<tr><td>Enter Email ID</td><td><input type="text" name="email"></td></tr>
<tr><td>Password</td><td><input type="password" name="pass"></td></tr>
<tr><td>Confirm Password</td><td><input type="password" name="cpass"></td></tr>
<tr><td>Enter Phone No</td><td><input type="text" name="phone"></td></tr>
<tr><td></td><td><input type="submit" value="Add" name="button"></td></tr>
</table>
</form>
</html>

June 20, 2011 at 5:37 PM

Need a login form with username, password, phone no, email id, date fields. We should specify the conditions for each field and if we press the submit button conditions of each field should appear. ex :*First name cannot be empty

Last Name cannot be empty

Email id cannot be empty

Password Cannot Be Empty

Conform Password cannot be empty

Phone Number Should Not Be Blank

if we given first name then first name cannot be empty should removed.

The submission should be uneven may be we can give date as first field and press submit submit button. I need this requirement pls help me out. thanx for answer

Ads









Related Tutorials/Questions & Answers:
Using java script do login form having fields with condition.
Using java script do login form having fields with condition.  Need a login form with username, password, phone no, email id, date fields. We should specify the conditions for each field and if we press the submit button
java login form using netbeans
java login form using netbeans  how to connect an access database to a login form using netbeans
Advertisements
Without Using Form in Java Script
Without Using Form in Java Script  HOw to Reset the data in javascript without using form tag
login form using java bean in eclipse
login form using java bean in eclipse  I have made a college community website but i need to implement beans to my login and contact us page. how can i do
Login Form with Java GUI using Netbeans
Login Form with Java GUI using Netbeans  Hi there! I'm a beginner in Java. I've created 2 class files: 1) TestAssign.java 2) NewFrame.java How can I have different user to login? Now that I've only administrator who is able
form to java script conversion
form to java script conversion  I am using a form one more form cotain a piece of code . how to convert it to java script to function it properly? code is shown below <form action="http://www.google.com" id="cse-search
standart login form for messenger in java
standart login form for messenger in java  hi i need login from for chating messenger in java. but its structure would like this Home Register Login User ID Password   Hi Friend
standart login form for messenger in java
standart login form for messenger in java  hi i need login from for chating messenger in java. but its structure would like this Home Register Login User ID Password   Hi Friend
How to design a form using java?
How to design a form using java?  Please help in designing of form using java for my project
barcode reader using java script
barcode reader using java script  Hai all, I need code for one application in java and java script my requirement is, Scanning data directly into a field is the easiest of all implementations. The cursor is placed
How to put the logo in login form using swings/awt?
How to put the logo in login form using swings/awt?  Hi, How to put the logo in login form using swings/awt? I write the login form is working... that will display logo along with login form in Java Swing. import javax.swing.
add cookies to login form in jsp by using struts2.0 framework
add cookies to login form in jsp by using struts2.0 framework  hi sir... struts2.0 and hibernate3.0 and mysql database for login .jsp now i want to add cookies to above form please help me
How to Create Login/ Registration Form using PHP and MYSQL
How to Create Login/ Registration Form using PHP and MYSQL  Hi, I am learning PHP. I have some dilemma how to create a Login Form and make connectivity with HTML page using PHP and MYSQL. Is there any body can guide me
login form
login form  sir my next form consists logout button when i click on it it showing login form but next form window is not closing but the components prepsent in that form are getting clearedup using frameobject.setVisible(false
How do i validate form using javascript and send data to database?
How do i validate form using javascript and send data to database?  I need a "JOIN US" form that can validate using javascript and be able to connect...(); return false; } return true; } </script> <form name="form" method
login and registration form using servlet and authentication through mysql
login and registration form using servlet and authentication through mysql  i made a simple login and rgistration form using servlet... help here is my code...plz chk the web.xml file also index.jsp(login form) <
Login Form
of +,on clicking which a login form appears. Only the middle column is different for each of the page. How to write a code for login authentication so...Login Form  I have 8 jsp pages.Each of them has three columns:Left
Login Form
of +,on clicking which a login form appears. Only the middle column is different for each of the page. How to write a code for login authentication so...Login Form  I have 8 jsp pages.Each of them has three columns:Left
Display Logo on login form using swing
Display Logo on login form using swing In this tutorial, you will learn how to display a logo in login form using swing components. Here is an example where... a logo for this login form, we have used ImageIcon class that accepts the image
Displatying java script form submitted elements in another page
Displatying java script form submitted elements in another page   hi I want java script and html code for displaying the values in other pager after submitting the registration form. I want to get the values after submitting
form field mapping with pdf file using java
form field mapping with pdf file using java   Hai all, I have one requirement that i have one html form.i have to map the form fields with pdf file. means, if click on text field according that perticular field .the data
Login With Drop Down, Having Departments in different table
Login With Drop Down, Having Departments in different table  Hi all.... And my issue is I want to login using different departments Customs and Accounts... with the Database during Login. One of my friend suggest me to use if(option.equals) condition
login form
login form  sir my next form consists logout button when i click on it it showing login form but next form window is not closing but the components prepsent in that form are getting clearedup using frameobject.setVisible(false
administrator login form
administrator login form   Hi iam using struts frame work backend as oracle .i want code for administrator login form thanks in advance
Spring Security Authorized Access Using Custom Login Form
Spring Security Authorized Access Using Custom Login Form In this section, you will learn about  authorized access using custom login form in Spring... access by providing  customized Login form using Spring Security. User
Spring alternative to Form Based Login
we make a server to listen to login event i.e. Authenticate a user not using jsp. Using a login form we can use the jspringsecurity_check. How can we do it by sending a web service call and not using any form based authentication
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
Spring 4: Login Form using Spring MVC and Hibernate Example
Spring 4 MVC Login Example: Database driven login form using Spring MVC... is the video tutorial of "Login Form using Spring MVC and Hibernate"... login form example with backend database validation using Hibernate Framework
Pagination with condition using servlet or jsp
Pagination with condition using servlet or jsp  Hi, Thanks... box and one submit button, After clicking the submit button that form field value I retrieved using "String name=request.getParameter("name of that text box

Ads