?
Solved

How do i make a validation page?

Posted on 2003-03-05
5
Medium Priority
?
165 Views
Last Modified: 2010-04-09
hi,

i was wondering if anyone can help me, i am currently doing a project on validation pages, but being generally new to internet programming, i havent a clue on how i would achive this. here is the outline for the project.

You are asked to produce a registration page for an English web site. The page should contain a form asking for the following information:
     Title (Drop down box)
     First name
     Last name
     Address Line 1
     Address Line 2 (optional to fill in)
     City
     County
     Postcode
     Telephone Number (optional to fill in)
     E-Mail address

In addition the following will be required:
     User name
     Password
     Password confirmation

The page should validate the fields and display an error message for any empty compulsory fields and boxes with the incorrect format. E.g. invalid e-mail address, numbers in the name field, etc.. The two attempts to enter a password must also agree although any restrictions on password.

Only if the form validates should a pop-up window appear containing the registration information (although obviously not the password).

again, i am really lost on this and if anyone could help me i would greatly apprieciate it. cheers.

SPACE-COWBOY....
0
Comment
Question by:space-cowboy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 10

Expert Comment

by:substand
ID: 8076115
you'll need to let us know which languages you are using to validate.

if it's javascript, you'll need to add the method to your form:

<form action="actionpage.htm" onsubmit="return validate();" id=formname>

then in your head add the following code:

<script language = "Javascript">

function echeck(str) {

          var at="@"
          var dot="."
          var lat=str.indexOf(at)
          var lstr=str.length
          var ldot=str.indexOf(dot)
          if (str.indexOf(at)==-1){
             alert("Invalid E-mail ID")
             return false
          }

          if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
             alert("Invalid E-mail ID")
             return false
          }

          if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
              alert("Invalid E-mail ID")
              return false
          }

           if (str.indexOf(at,(lat+1))!=-1){
              alert("Invalid E-mail ID")
              return false
           }

           if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
              alert("Invalid E-mail ID")
              return false
           }

           if (str.indexOf(dot,(lat+2))==-1){
              alert("Invalid E-mail ID")
              return false
           }
         
           if (str.indexOf(" ")!=-1){
              alert("Invalid E-mail ID")
              return false
           }

            return true                        
     }

function validate(){
     var emailID=document.frmSample.txtEmail
     
     if ((emailID.value==null)||(emailID.value=="")){
          alert("Please Enter your Email ID")
          emailID.focus()
          return false
     }
     if (echeck(emailID.value)==false){
          emailID.value=""
          emailID.focus()
          return false
     }
     return true
 }
</script>

all the other validations are similar and can use snippets from that code.  that code is from http://www.smartwebby.com/DHTML/email_validation.asp

... you can check more there if you need it.

0
 

Author Comment

by:space-cowboy
ID: 8078382
hi,

thanks for that will be trying it asap. i am using HTML and Java if thats any use?

thanks again.

Space-cowboy
0
 
LVL 10

Expert Comment

by:substand
ID: 8081965
java or javascript?  it sounds like what you need is javascript. if so, send the html for your form and i'll do a quick auto-validate that you'll need to edit a bit, like the var names and stuff.
0
 

Author Comment

by:space-cowboy
ID: 8083931
k, here is the html, been using frontpage, dont know if thats any good, its just what i have been told to use.

cheers.

<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<meta name="Microsoft Theme" content="network 011, default">
</head>

<body>

<form method="POST" action="--WEBBOT-SELF--">
  <!--webbot bot="SaveResults" U-File="file:///C:/Documents and Settings/Paul/My Documents/My Webs/myweb/_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><p>
  <!--webbot bot="Validation" S-Display-Name="Title" B-Value-Required="TRUE" --><select size="1" name="D1" multiple>
  <option>MR</option>
  <option>Miss</option>
  <option>Mrs</option>
  <option>Ms</option>
  </select></p>
</form>
<p>First Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="T1" size="20"></p>
<p>Last name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="T1" size="20"></p>
<p>Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="T1" size="20"></p>
<p>Address 2 *(optional)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="T1" size="20"></p>
<p>City&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="T1" size="20"></p>
<p>County&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="T1" size="20"></p>
<p>Post code&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="T1" size="20"></p>
<p>Telephone No *(optional)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="T1" size="20"></p>
<p>Email address.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="T1" size="20"></p>
<p>
===================================================================================</p>
<p>Please select username and password.</p>
<p>Username&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="T1" size="20"></p>
<p>Password&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="password" name="T1" size="20"></p>
<p>Confirm password&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="password" name="T1" size="20"></p>
<p>&nbsp;</p>
<form method="POST" action="--WEBBOT-SELF--">
  <!--webbot bot="SaveResults" U-File="file:///C:/Documents and Settings/My Documents/My Webs/myweb/_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><p>
  <input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

</body>

</html>
0
 
LVL 6

Accepted Solution

by:
Mindphaser earned 80 total points
ID: 8088075
Our experts are usually willing to help, BUT they don't do the homework. If people post the relevant part of the work they already did and if they have a very specific question about it most experts will jump in.

What we discourage is something like:
"Write a program that reads file xxx and does yyy with the number of that file"
and experts will post the complete code. That IS AGAINST 'academic honesty' as mentioned in the Member Agreement at http://www.experts-exchange.com/jsp/infoMemberAgreement.jsp.

** Mindphaser - Community Support Moderator **
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
Suggested Courses

770 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