Jump to content

Recommended Posts

Posted

hello, i don't have much experience in html, i've tried smth but.... i messed up :D i want to add validation on these:

 

<div id="content">
      <div class="outside home" id="page">
        <div class="sidebar box login">
          <div class="header"></div>
            </legend>
            <p>You must enter all fields marked with a <span class="row"><span class="warn">*</span></span>. </p>
            <p> </p>
            <form action="" id="validate" >
            <p>
              <label for="first_name">First Name: <span class="warn">*</span><br /></label>
              <input type="text" id="first_name" name="first_name" value="" />
            </p>
            <p>
              <label for="lat_name">Last Name: <span class="warn">*</span><br /></label>
              <input type="text" id="last_name" name="last_name" value="" />
            </p>
            <label for="delivery_country" class="country"> Country:  <span class="warn">*</span><br /></label>
            <select name="delivery_country" id="delivery_country" class="country">
              <option value="Albania" >Albania</option>
              <option value="Andorra" >Andorra</option>
              <option value="Anguilla" >Anguilla</option>
              <option value="Argentina" >Argentina</option>
              <option value="Armenia" >Armenia</option>
              <option value="Australia" >Australia</option>
              <option value="Austria" >Austria</option>
              <option value="Azerbaijan" >Azerbaijan</option>
              <option value="Bahamas" >Bahamas</option>
            </select>
            <p>
              <label for="first_name">Phone Number :  <span class="warn">*</span><br /></label>
              <input type="text" id="phone_number" name="phone_number" value="" />
            </p>
            <p>
              <label for="house_name">House Name or Number : <span class="warn">*</span><br /></label>
              <input type="text" id="house_name" name="house_name" value="" />
            </p>
            <p>
              <label for="address_line">Address line 1 : <span class="warn">*</span><br /></label>
              <input type="text" id="address_line" name="address_line" value="" />
            </p>
            <p>
              <label for="town_city">Town/City : <span class="warn">*</span><br /></label>
              <input type="text" id="town_city" name="town_city" value="" />
            </p>
            <p>
              <label for="post_code">Postcode : <span class="warn">*</span><br /></label>
              <input autocomplete="off" type="text" id="post_code" name="post_code" value="" />
              <script type="text/javascript">
			<!--hide from JavaScript-challenged browsers
			YAHOO.util.Event.addListener(window, "load", function(){
			document.login_form.login_password.focus();
			if (document.login_form.login_email.value == '') {
			document.login_form.login_email.focus();
			}
			});
			// done hiding -->
               </script>
            </p>
            
            </dd>
            <dd>
              <p>
            <input type="submit" name="submit.x" value="Confirm" class="testing2"></p></dd>
	</form>
        </div></div>
<div class="main"><div class="zone">
<div class="MktMPI" id="mpi550001">
              </p>
            </dd>
          </div>
        </div>
        <script  type="text/javascript">
			var frmvalidator = new Validator("validate");
			frmvalidator.addValidation("first_name","req","Please enter your First Name");
			frmvalidator.addValidation("first_name","maxlen=20",
        		"Max length for First Name is 20");

			frmvalidator.addValidation("last_name","req");
		frmvalidator.addValidation("last_name","maxlen=20",
        		"Max length for Last Name is 20");

			frmvalidator.addValidation("phone_number","maxlen=30",
        		"Max length for Phone Number is 30");
			frmvalidator.addValidation("phone_number","numeric");

			frmvalidator.addValidation("Address","maxlen=50");
			frmvalidator.addValidation("delivery_country","dontselect=000");

		frmvalidator.addValidation("house_name","req");
		frmvalidator.addValidation("house_name","maxlen=50",
        		"Max length for Hour Name is 50");

		frmvalidator.addValidation("address_line","req");
		frmvalidator.addValidation("address_line","maxlen=35",
        		"Max length for Address Line is 35");

		frmvalidator.addValidation("town_city","req");
		frmvalidator.addValidation("town_city","maxlen=20",
        		"Max length for City/Town is 20");

		frmvalidator.addValidation("post_code","maxlen=20",
        		"Max length for Postal Code is 20");
			frmvalidator.addValidation("post_code","numeric");
		</script>

 

before "/head" i have add "<script src="gen_validatorv4.js" type="text/javascript"></script>" ...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...