|
| A R C H I V E D M E S S A G E |
|
Subject: The java script code comes with v9 |
| Posted: 01/22/2004 at 11:20:49 pm |
| By: mehdi |
| hi
there is a javescript required file come with v9 . what can i do with it there is no refrance about it in instalation file . how can i use it and what is it
any idea
Regards,
mehdi | |
|
|
Subject: Re: The java script code comes with v9 |
| Posted: 01/23/2004 at 8:15:17 am |
| By: Seth Knorr |
| If you want to do Javascript Validation, you can use that file to achieve this, You realy just need to know Javascript.
I will probably write a Javascript how to, on form validation that will work.
But for a simple how to, here you go. (ALL JAVASCRIPT CODE IS IN RED)
1. Copy and paste the code from the file onto your HTML form page.
2. It already checks to see if the email address is valid with:
if (document.Subscribe.email.value!="")
{
if (document.Subscribe.email.value.indexOf("@")==-1 || document.Subscribe.email.value.indexOf(".")==-1 || document.Subscribe.email.value.indexOf(" ")!=-1 || document.Subscribe.email.value.length<6)
{alert("Sorry, your e-mail address is not valid.");
document.Subscribe.email.focus();return false}
}
if(document.Subscribe.email.value.length <1)
{alert("You must enter a valid e-mail address")
document.Subscribe.email.focus();return false}
IF YOU WISH NOT TO VALIDATE THIS REMOVE THIS SECTION.
The below three validate fields:
firstname
lastname
phone
Breaking down the parts of below javascript per field
LINE 1: If statement checks to see if field "firstname" is less than length 1
LINE 2: IF it is a javascript alert will apear on the page stating: "You left the First Name field blank"
LINE 3: Tells page to focus on the "firstname" field if LINE 1 is less than length 1
if(document.Subscribe.firstname.value.length <1)
{alert("You left the First Name field blank")
document.Subscribe.firstname.focus();return false}
ADDING NEW FIELDS TO VALIDATE?
1. Just change the Subscribe.firstname in LINE 1 & 3
To the field name you want to validate.
Ex. Subscribe.fieldname
2. CHANGE the alert message on LINE 2.
{alert("You left the field blank")
NOTE TO USE THE THE FORM name must = "Subscribe"
You must also include:
onSubmit="return finalCheck(this);"
This will call the javascript to check fields upon submitting the form.
example:
<form method="POST" action="bizmail.cgi" name="Subscribe" onSubmit="return finalCheck(this);">
Thats it you are all set.
Seth | |
|
|
Subject: Re: The java script code comes with v9 |
| Posted: 01/26/2004 at 12:13:42 am |
| By: mehdi |
| Hi
Thanks so much, your form is great and I ame working on it to customize it for the site that I am setting up. if you like I like to permote your site in the search engine in lvstar.com
thaks again
mehdi | |
|
|
Subject: Re: The java script code comes with v9 |
| Posted: 01/28/2004 at 5:42:27 am |
| By: Seth Knorr |
| Sure any help with search engines would be great,
Seth | |
|
|