473,385 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Trouble with a registration page

I am having trouble with a registration page. Which contains 3 groups of radio buttons and a check box i having hard time to making it work. I have added code for matching the password too but having trouble making it work. I also wanted to know how to make the select box mandatory through javascript.

Can anyone help me out by providing me with a registration page or some code which covers above problems.

Thanks for all the help guys.

roger
Sep 10 '07 #1
2 1194
gits
5,390 Expert Mod 4TB
hi ...

welcome to TSDN ...

post some sample-code you already have ...

one note beside: don't rely on password-matching on the clientside ... the js-code is locally and the user may change or even avoid your matching by changing the code locally ... double-check it an serverside!

kind regards
Sep 10 '07 #2
Expand|Select|Wrap|Line Numbers
  1. // JavaScript Document
  2. function formValidator()
  3.        { 
  4.           if(document.all("firstname").value=="")
  5.             {
  6.               alert ("Please enter your First Name")
  7.               return false;
  8.  
  9.             }
  10.           if(document.all("lastname").value=="")
  11.             {
  12.                alert ("Please enter your Last Name")
  13.                return false;
  14.  
  15.             }
  16.           if(document.all("username").value=="")
  17.             {
  18.                 alert ("Please enter your User Name")
  19.                 return false;
  20.             }
  21.           if(document.all("pass").value=="")
  22.             {
  23.                 alert ("Please enter your Password")
  24.                 return false;
  25.  
  26.             }
  27.           if(document.all("confirmpassword").value=="")
  28.             {
  29.                 alert ("Please confirm your passowrd!")
  30.                 return false;
  31.             }
  32.           if(document.all("sansw").value=="")
  33.             {
  34.                 alert ("Please enter your security answer!")
  35.                 return false;
  36.  
  37.             }
  38.           if(document.all("email").value=="")
  39.             {
  40.                 alert ("Please enter your Email-Id!")
  41.                 return false;
  42.  
  43.             }
  44.  
  45.           if(document.all("phno").value=="")
  46.             {
  47.                 alert ("Please enter your phone number!")
  48.                 return false;
  49.  
  50.             }
  51.          // if (document.signup.confirm.checked == false)
  52.         //    {
  53.          //         alert("You need to read and agree to the terms of service.")
  54.          //        return false;
  55.         //    }
  56. if (document.signup.confirm.checked == false) {
  57.     // box is not checked
  58.     alert("You need to read and agree to the terms of service.")
  59.     return false;
  60. } return true;
  61.        }
  62.  
  63. function Alphabet(sID)
  64.        {
  65.             var regExp = new RegExp("[^a-zA-Z]");
  66.              if(!document.all(sID).value.match(regExp))
  67.               {
  68.                return true;
  69.               }
  70.               else
  71.               {
  72.                 alert("Please enter charecters a-z or A-Z!");
  73.                 document.all(sID).value.focus()
  74.                 return false;
  75.               }
  76.        }
  77.  
  78. function AlphNumeric(sID)
  79.        {
  80.             var regExp = new RegExp("[^-,0-9a-zA-Z]");
  81.             if(!document.all(sID).value.match(regExp))
  82.              {
  83.                return true;
  84.              }
  85.              else
  86.              {
  87.                 alert("Please enter alphabets and numbers");
  88.                 document.all(sID).focus()
  89.                 return false;
  90.              }
  91.        }
  92.  
  93. function isEmpty(sID)
  94.        {
  95.            if(document.all(sID).value.length == 0)
  96.             {
  97.               alert("Please enter " +sID+ "!");
  98.               document.all(sID).focus(sID); // set the focus to this input
  99.               return true;
  100.             }
  101.            return false;
  102.        }
  103.  
  104. function passsame(sID)
  105.        {
  106.            var passv = document.all('pass').value
  107.            var cpass = document.all(sID).value
  108.            if( cpass != match(passv) )
  109.             {
  110.                alert("Password doesn't match");
  111.                document.all(sID).focus(sID);
  112.                return false;
  113.             }
  114.             else
  115.             {
  116.                 return true;
  117.             }
  118.        } 
  119.  
  120. function isNumeric(sID)
  121.        {
  122.            var numericExpression = /^[0-9]+$/;
  123.            if(document.all(sID).value.match(numericExpression))
  124.              {
  125.                return true;
  126.              }
  127.              else
  128.              {
  129.                 alert("Phone number should be 0-9!");
  130.                 document.all(sID).focus(sID);
  131.                 return false;
  132.              }
  133.         }
  134.  
  135. function lengthRestriction(sID)
  136.         {
  137.                var uInput = document.all(sID).value;
  138.             if(uInput.length >= 6 && uInput.length <= 10)
  139.               {
  140.                 return true;
  141.               }
  142.               else
  143.               {
  144.                  alert("Please enter between 6 and 10 characters");
  145.                  document.all(sID).focus(sID);
  146.                  return false;
  147.                }
  148.          }
  149.  
  150. /*function madeSelection(elem, helperMsg)
  151.          {
  152.               if(elem.value == "Please Choose")
  153.                {
  154.                   alert(helperMsg);
  155.                   elem.focus();
  156.                   return false;
  157.                }
  158.                else
  159.                {   
  160.                    alert(helperMsg);
  161.                    elem.focus();
  162.                    return true;
  163.                 }
  164.           }
  165. */
  166. function emailValidator(sID)
  167.           {
  168.                var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
  169.                if(document.all(sID).value.match(emailExp))
  170.                  {
  171.                     return true;
  172.                  }
  173.                  else
  174.                  {
  175.                      alert("Please enter Email Id in proper way!");
  176.                      document.all(sID).focus();
  177.                      return false;
  178.                  }
  179.            }
  180.  
  181. function setStyle(sID)
  182.            {
  183.                  document.getElementById(sID).style.background="lightyellow"
  184.            }
  185.  
  186.  
  187. function removeStyle(sID)
  188.            {
  189.                   document.getElementById(sID).style.background="white"
  190.            }
  191.  
  192. function checkbob(sID)
  193.             {
  194.                 if (!document.signup.field.checked) 
  195.                 {
  196.                  // box is not checked
  197.                  alert("You need to read and agree to the terms of service.")
  198.                  return false;
  199.                  }
  200.              }
  201.  
this is the code i am working with presently.
Sep 10 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: JaNE | last post by:
Hello, I have made my cms... and is working, but have some, let me say "bugs"... And I don't know all reasons, please allow me slightly longer and most probably confusing post (that "confusing" is...
3
by: LMachado1 | last post by:
I just started with php and I'm trying to make a simple interface as follows: - user is asked to input an integers, for example: how many students do you want to enter? - user is then shown a...
3
by: BravesCharm | last post by:
BravesCharm Dec 7, 10:57 am show options Newsgroups: microsoft.public.dotnet.distributed_apps From: "BravesCharm" <mastrauc...@gmail.com> Date: 7 Dec 2004 10:57:40 -0800 Local: Tues, Dec...
0
by: somespam | last post by:
Hi Can anyone recommend methods or articles on creating a "registration" system for a web-based application I.e Application gets installed on a web domain e.g. www.hello.com, the user accesses...
4
by: EagleRed | last post by:
I am writing an ASP.NET 2.0 application that uses more than one master page. Currently, there are two pages, Freedom1.master and Freedom2.master. I have no problems with Freedom1.master. However,...
0
by: Wayne Smith | last post by:
I've taken the following code from a developers web site which should allow a user to register and receive an email message with a link to activate their account, but when I click the link on my...
9
by: johnd126 | last post by:
I have a cgi program which outputs a fairly hefty amount of html/javascript for doing a complex slide show sorta thing in a variety of areas in the browser. I accomplish this by creating a series...
3
by: satishknight | last post by:
Hi, Can some one tell me how to change the validation sequence for the code pasted below, actually what I want it when any one enters the wrong login information (already registered users) then it...
4
by: Ananthu | last post by:
Hi, I have to ask one question because i am new in developing project using ASP.NETCurrently I am doing project in ASP.NET. I have designed pages for the client side that is the users who are...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.