Current location: Hot Scripts Forums » General Web Coding » JavaScript » Disable form fields to be submitted


Disable form fields to be submitted

Reply
  #1 (permalink)  
Old 05-16-04, 06:40 PM
RickyRod RickyRod is offline
New Member
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Disable form fields to be submitted

have developed a form to be submitted online. I need to be able to disable the second boxes group under Model2 if the user wants to send info only about one model. I have several required fields including in model 2 boxes group. If they are not completed, the form cannot be submitted. So I need to be able to disable in certain situations.. How can i do this ...I would really appreciate some help. Thanks lots.
Best Regards..

Here is the code:

<HTML>
<HEAD>

<TITLE>Order Form</TITLE>

<LINK HREF="./includes/stylesheet.css" TYPE="text/css" REL="stylesheet">

<script language="javascript"><!--
var empty_fields = "";
var errors = "";

//************************************************** *****************
//* Validate E-mail Address
//************************************************** *****************
function validEmail(url) {
if (url == "")
{
empty_fields += "\n Email";
return false;
}
else {
var a = url.lastIndexOf("@");
var b = url.lastIndexOf(".");
var c = url.indexOf(":");
var d = url.indexOf("/");
var e = url.substring(0,a);
var f = e.indexOf("@");
var g = url.substring(a+1,url.length);
var h = g.indexOf("[");
var i = g.indexOf("]");
var j = g.indexOf("<");
var k = g.indexOf(">");
var l = url.substring(a+1,b);
var m = url.substring(b+1,url.length);
var n = url.substring(0,a);
var o = 0;
var p = url.indexOf(";");
var q = url.indexOf(" ");
if (a > b) {o++};
if (c != -1) {o++};
if (d != -1) {o++};
if (f != -1) {o++};
if (h != -1) {o++};
if (i != -1) {o++};
if (j != -1) {o++};
if (k != -1) {o++};
if (l.length < 2) {o++};
if (m.length < 2) {o++};
if (n.length < 1) {o++};
if (p != -1) {o++};
if (q != -1) {o++};

if (o == 0)
{
return true;
}
else
{
errors += "\n-You have entered an invalid email address.";
return false;
}
}
}


//************************************************** *****************
//*Validate the Account
//************************************************** *****************
function validAccount(s){
if (s == "")
{
empty_fields += "\n Account";
return false;
}
if (s.length != 6)
{
errors += "\n-The Account field must contain 6 digits";
return false;
}
var checkOK = "0123456789";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-You can only enter digits in the Account field.";
return false;
}
else
{
return true;
}
}







//************************************************** *****************
//*Validate the Company Name
//************************************************** *****************
function validCompany(s){
if ((s == "") || (s== "Company"))
{
empty_fields += "\n Company";
return false;
}

var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw xyz' ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The Company Name field can not include digits.";
return false;
}
else
{
return true;
}
}



//************************************************** *****************
//*Validate the Contact Name
//************************************************** *****************
function validContactName(s){
if ((s == "") || (s== "First"))
{
empty_fields += "\n Contact Name";
return false;
}

var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw xyz' ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The Contact Name field can not include digits.";
return false;
}
else
{
return true;
}
}

//************************************************** *****************
//*Validate the Customer Name
//************************************************** *****************
function validCustomerName(s){
if ((s == "") || (s== "Customer"))
{
empty_fields += "\n Customer Name";
return false;
}

var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw xyz' ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The Customer Name field can not include digits.";
return false;
}
else
{
return true;
}
}


//************************************************** *****************
//*Validate the Customer Phone Number
//************************************************** *****************
function validCustomerPhone(s){
if ((s == "") || (s =="Customer_Phone"))
{
empty_fields += "\n Customer Phone Number";
return false;
}

var checkOK = "0123456789-'() ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The Customer Phone Number field can not include special characters.";
return false;
}
else
{
return true;
}
}

//************************************************** *****************
//*Validate the Customer Address
//************************************************** *****************
function validCustomerAddress(s){
if ((s == "") || (s =="Address"))
{
empty_fields += "\n Customer Address";
return false;
}

var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw xyz0123456789-' ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The Customer Address field can not include special characters.";
return false;
}
else
{
return true;
}
}


//************************************************** *****************
//*Validate the Phone Number
//************************************************** *****************
function validPhoneNumber(s){
if ((s == "") || (s =="Phone_Number"))
{
empty_fields += "\n Phone Number";
return false;
}

var checkOK = "0123456789-'() ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The Phone Number field can not include special characters.";
return false;
}
else
{
return true;
}
}

//************************************************** *****************
//*Validate the Fax Number
//************************************************** *****************
function validFaxNumber(s){
if ((s == "") || (s =="Fax_Number"))
{
empty_fields += "\n Fax Number";
return false;
}

var checkOK = "0123456789-'() ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The Fax Number field can not include special characters.";
return false;
}
else
{
return true;
}
}

//************************************************** *****************
//*Validate the Purchase Order #
//************************************************** *****************
function validPurchaseOrder(s){
if ((s == "") || (s =="Last"))
{
empty_fields += "\n Purchase Order";
return false;
}

var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw xyz0123456789-' ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The Purchase Order field can not include special characters.";
return false;
}
else
{
return true;
}
}

//************************************************** *****************
//*Validate the City
//************************************************** *****************
function validCity(s){
if (s == "")
{
empty_fields += "\n City";
return false;
}

var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw xyz' ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The City field can not include digits.";
return false;
}
else
{
return true;
}
}


//************************************************** *****************
//*Validate the Zip Code
//************************************************** *****************
function validZipCode(s){
if ((s == "") || (s =="Zip"))
{
empty_fields += "\n Zip Code";
return false;
}

var checkOK = "0123456789 ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The Zip Code field can not include special characters.";
return false;
}
else
{
return true;
}
}

//************************************************** *****************
//*Validate the Model Number1
//************************************************** *****************
function validModelo(s){
if ((s == "") || (s =="PartO"))
{
empty_fields += "\n Model Number #1";
return false;
}

var checkOK = "0123456789- ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The model Number field can not include special characters.";
return false;
}
else
{
return true;
}
}


//************************************************** *****************
//*Validate the Quantity one
//************************************************** *****************
function validQuantityOne(s){
if ((s == "") || (s =="Quantityo"))
{
empty_fields += "\n Quantity #1";
return false;
}

var checkOK = "0123456789- ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The quantity field can not include special characters.";
return false;
}
else
{
return true;
}
}


//************************************************** *****************
//*Validate the Date Code 1 #
//************************************************** *****************
function validDatOne(s){
if ((s == "") || (s =="Dato"))
{
empty_fields += "\n Date Code #1";
return false;
}

var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw xyz0123456789- ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The date code field can not include special characters.";
return false;
}
else
{
return true;
}
}

//************************************************** *****************
//*Validate the Model Number2
//************************************************** *****************
function validModelt(s){
if ((s == "") || (s =="Partt"))
{
empty_fields += "\n Model Number #2";
return false;
}

var checkOK = "0123456789- ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The model number field can not include special characters.";
return false;
}
else
{
return true;
}
}


//************************************************** *****************
//*Validate the Qty2
//************************************************** *****************
function validQuantityt(s){
if ((s == "") || (s =="Qtyt"))
{
empty_fields += "\n Quantity #2";
return false;
}

var checkOK = "0123456789 ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The quantity #2 field can not include special characters.";
return false;
}
else
{
return true;
}
}


//************************************************** *****************
//*Validate the Date Code 2
//************************************************** *****************
function validDatt(s){
if ((s == "") || (s =="Datet"))
{
empty_fields += "\n Date Code #2";
return false;
}

var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw xyz0123456789-' ";
var checkStr = s;
var allValid = true;

for (i = 0; i < checkStr.length; i++)
{

ch = checkStr.charAt(i);

for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
errors += "\n-The date #2 code field can not include special characters.";
return false;
}
else
{
return true;
}
}


//************************************************** *****************
//*A utility function that returns true if a string contains
//*only whitespace characters
//************************************************** *****************
function isblank(s)
{
for(var i = 0; i < s.length; i++)
{
var c = s.charAt(i);
if ((c != '') && (c!= '\n') && (c !='\t')) return false;
}
return true;
}

//************************************************** *****************
//*A utility function that returns true if a field is blank
//************************************************** *****************
function verify(f)
{
if ((f.value == null) || (f.value == "") || isblank(f.value)) return true;
}

//************************************************** *****************
//*A function that verifies that all required Form inputs are entered and valid
//*If any are not valid, an alert listing the input names is sent to
//*the screen, else the form submit method is called
//************************************************** *****************

function Submitting()
{
//* validate the Account
validAccount(document.FormContacts.Account.value)

//* validate the Company Name field
validCompany(document.FormContacts.Company.value)

//* validate the Contactname field
validContactName(document.FormContacts.Contact_Nam e.value)

//* validate the Phone Number field
validPhoneNumber(document.FormContacts.Phone_Numbe r.value)

//* validate the Fax Number field
validFaxNumber(document.FormContacts.Fax_Number.va lue)

//* validate the Customername field
validCustomerName(document.FormContacts.Customer_N ame.value)

//* validate the Customer Phone Number field
validCustomerPhone(document.FormContacts.Customer_ Phone.value)

//* validate the Customer address field
validCustomerAddress(document.FormContacts.Address .value)

//* validate the Purchase Order field
validPurchaseOrder(document.FormContacts.Purchase_ Order.value)


//* validate the City field
validCity(document.FormContacts.City.value)

//* validate the State field
if (verify(document.FormContacts.State.options[document.FormContacts.State.selectedIndex])) empty_fields += "\n State";

//* validate the Zip Code field
validZipCode(document.FormContacts.Zip.value)







//* validate the Quantity one field
validQuantityOne(document.FormContacts.Quantityo.v alue)



//* validate the Model Number1 field
validModelo(document.FormContacts.PartO.value)

//* validate the Date Code 1 field
validDatOne(document.FormContacts.Dato.value)

//* validate the Model Number2 field
validModelt(document.FormContacts.Partt.value)

//* validate the Qty2 field
validQuantityt(document.FormContacts.Qtyt.value)

//* validate the Date Code 2 field
validDatt(document.FormContacts.Datet.value)




//* validate the email field
validEmail(document.FormContacts.email.value)








//* Build error message
if( (isblank(empty_fields) || (empty_fields == null) || (empty_fields == "")) && (isblank(errors) || (errors == null) || (errors == "")))
{
//*document.survey.submit();
return (true);
}
else
{
msg = "_________________________________________________ _____________\n\n";
msg += "The Page was not submitted becuase the following error(s). \n";
msg += "Please correct these errors and re-submit \n";
msg += "_________________________________________________ ____________\n";

if (empty_fields)
{
msg += "-The following required fields(s) are empty:" + empty_fields +"\n";
}
if (errors)
{
msg += errors
}
alert(msg);
empty_fields = "";
errors = "";
return (false);
}
}
//--></script>


<script language="javascript"><!--
var NS = (window.Event) ? 1 : 0;

function checkKey(e) {
var code = (NS) ? e.which : event.keyCode;

if (code == "13"){
return false; }
}

document.onkeypress = checkKey;

//--></script>



<script language ="JavaScript">
<!-- Begin hiding here --


function start_date()
{

var now = new Date();


var today = now.getDay();

var month = now.getMonth();

var year = now.getYear();

var date = now.getDate();



if (today == 0) today = "Sunday, ";

else if (today == 1) today = "Monday, ";

else if (today == 2) today = "Tuesday, ";

else if (today == 3) today = "Wednesday, ";

else if (today == 4) today = "Thursday, ";

else if (today == 5) today = "Friday, ";

else if (today == 6) today = "Saturday, ";

if (month == 0) month = "January ";

else if (month == 1) month = "February ";

else if (month == 2) month = "March ";

else if (month == 3) month = "April ";

else if (month == 4) month = "May ";

else if (month == 5) month = "June ";

else if (month == 6) month = "July ";

else if (month == 7) month = "August ";

else if (month == 8) month = "September ";

else if (month == 9) month = "October ";

else if (month == 10) month = "November ";

else if (month == 11) month = "December ";


document.FormContacts.date.value = today + month + date + ", " + year

setTimeout("start_date()", 1000);

}

// -- End hiding here -->
</script>


</HEAD>




<!--<body onLoad = "start_date()">-->
<BODY onLoad ="start_date()" BGCOLOR="#FFFFFF" TEXT="#000000" ALINK="#0000FF" VLINK="#0000FF" LINK="#0000FF" >
<table border="2" width=700>
<tr><td><IMG SRC="./images/servpicns.jpg" WIDTH="460" HEIGHT="144" ALIGN="MIDDLE" BORDER="0"></td></tr>

<tr><td>
<IMG SRC="./images/small.gif" WIDTH="460" HEIGHT="5" ALIGN="BOTTOM" BORDER="0" NATURALSIZEFLAG="0">
</td></tr>


<tr><td align="center" valign="bottom" Class="stdFontB">
<U>Form</U>


<FORM ACTION="mhgtn.php" method="POST" onsubmit="return Submitting()" name="FormContacts">
<TABLE border=1 width=600>

<TR>
<td>&nbsp;</td><td align="right" Class="stdFont"><b>Today's date:</b>&nbsp;&nbsp;<input name ="date" size ="26" Class="stdFont" value ="Loading..."></td></tr>

<tr>
<TD>&nbsp;</TD>
</tr>
<tr>
<TD Class="stdFont">Purchase Order:</TD>
<TD Class="stdFont"><INPUT NAME="Purchase_Order" Size=22>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accoun t Number:&nbsp;<INPUT NAME="Account" size="20" MAXLENGTH=6></TD>
</TR>
<TR>
<TD Class="stdFont">Customer Name:</TD>
<TD><INPUT NAME="Customer_Name" size=22>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compan y Name:&nbsp;&nbsp;<INPUT NAME="Company" size="20" MAXLENGTH=20></TD>
</TR>
<TR>
<TD Class="stdFont">Customer Phone:</td>
<TD><INPUT NAME="Customer_Phone" size=22>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Contac t Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT NAME="Contact_Name" size="20" MAXLENGTH=20></TD>
</TR>
<TR>
<TD Class="stdFont">Customer&nbsp;Address: </td>
<TD><INPUT NAME="Address" size=22>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Phone Number:&nbsp;&nbsp;&nbsp;&nbsp;<INPUT NAME="Phone_Number" size="20" MAXLENGTH=20></TD>
</TR>
<TD>City:</TD>
<TD><INPUT NAME="City" size=22>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fax Number:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;<INPUT NAME="Fax_Number" size="20" MAXLENGTH=20></td>
</TR>
<TR>
<TD>State:</td><td>
<select name="State">
<option value="">Select State</option>
<option value=AL>Alabama</option>
<option value=AK>Alaska</option>
<option value=AB-Canada>Alberta</option>
<option value=AZ>Arizona</option>
<option value=AR>Arkansas</option>
<option value=BC-Canada>British Columbia</option>
<option value=CA>California</option>
<option value=CO>Colorado</option>
<option value=CT>Connecticut</option>

<option value=DE>Delaware</option>
<option value=FL>Florida</option>
<option value=GA>Georgia</option>
<option value=HI>Hawaii</option>

<option value=ID>Idaho</option>
<option value=IL>Illinois</option>
<option value=IN>Indiana</option>
<option value=IA>Iowa</option>
<option value=KS>Kansas</option>
<option value=KY>Kentucky</option>
<option value=LA>Louisiana</option>
<option value=ME>Maine</option>
<option value=MB-Canada>Manitoba</option>
<option value=MA>Massachusetts</option>
<option value=MD>Maryland</option>

<option value=MI>Michigan</option>
<option value=MN>Minnesota</option>
<option value=MS>Mississippi</option>
<option value=MO>Missouri</option>

<option value=MT>Montana</option>

<option value=NE>Nebraska</option>
<option value=NV>Nevada</option>
<option value=NH>New Hampshire</option>
<option value=NJ>New Jersey</option>
<option value=NM>New Mexico</option>

<option value=NY>New York</option>
<option value=NC>North Carolina</option>
<option value=ND>North Dakota</option>
<option value=NS-Canada>Nova Scotia</option>
<option value=OH>Ohio</option>
<option value=OK>Oklahoma</option>
<option value=OR>Oregon</option>
<option value=ON>Ontario</option>
<option value=PA>Pennsylvania</option>
<option value=PR>Puerto Rico</option>
<option value=QU-Canada>Quebec</option>
<option value=RI>Rhode Island</option>
<option value=SC>South Carolina</option>
<option value=SD>South Dakota</option>
<option value=TN>Tennessee</option>
<option value=TX>Texas</option>
<option value=UT>Utah</option>
<option value=VA>Virginia</option>
<option value=VT>Vermont</option>

<option value=WA>Washington</option>
<option value=DC>Washington, D.C.</option>
<option value=WI>Wisconsin</option>
<option value=WV>West Virginia</option>
<option value=WY>Wyoming</option>
</select>

&nbsp;&nbsp;Zip Code:&nbsp;&nbsp;<INPUT NAME="Zip" size="6" MAXLENGTH=6></td></TR>




<TR>
<TD Class="stdFont">Email Address:</TD>
<TD><INPUT NAME="email" SIZE=25></TD>
</TR>

<TR>
<TD COLSPAN=2>
<IMG SRC="./images/small.gif" WIDTH="450" HEIGHT="3" ALIGN="BOTTOM" BORDER="0" NATURALSIZEFLAG="0">
<BR></TD>
</TR>


<TR>
<TD Class="stdFont">Model1:</TD>
<TD Class="stdFont"><INPUT NAME="PartO" SIZE=12 MAXLENGTH=12 MINLENGTH=4>&nbsp;&nbsp;Desc:&nbsp;<INPUT NAME="Desc1" SIZE=15 MAXLENGTH=15>&nbsp;&nbsp;Qty:&nbsp;<INPUT NAME="Quantityo" SIZE=3 MAXLENGTH=3>&nbsp;&nbsp;&nbsp;&nbsp;Date Code:&nbsp;<INPUT NAME="Dato" SIZE=3 MAXLENGTH=8></TD>
</TR>
<TR>
<TD Class="stdFont">Handling Fee:</TD>
<TD Class="stdFont"><INPUT NAME="HFee1" SIZE=6 MAXLENGTH=14>&nbsp;&nbsp;&nbsp;&nbsp;Shipping Charges:&nbsp;<INPUT NAME="Ship1" SIZE=8 MAXLENGTH=8>&nbsp;&nbsp;&nbsp;&nbsp;WC Price:&nbsp;<INPUT NAME="Price1" SIZE=6 MAXLENGTH=8></TD>
</TR>


<TR><TD>&nbsp;</TD></TR>

<TR>
<TD Class="stdFont">Model2:</TD>
<TD Class="stdFont"><INPUT NAME="Partt" SIZE=12 MAXLENGTH=12 MINLENGTH=4>&nbsp;&nbsp;Desc:&nbsp;<INPUT NAME="Desc2" SIZE=15 MAXLENGTH=15>&nbsp;&nbsp;Qty:&nbsp;<INPUT NAME="Qtyt" SIZE=3 MAXLENGTH=3>&nbsp;&nbsp;&nbsp;&nbsp;Date Code:&nbsp;<INPUT NAME="Datet" SIZE=3 MAXLENGTH=8></TD>
</TR>
<TR>
<TD Class="stdFont">Handling Fee:</TD>
<TD Class="stdFont"><INPUT NAME="HFee2" SIZE=6 MAXLENGTH=14>&nbsp;&nbsp;&nbsp;&nbsp;Shipping Charges:&nbsp;<INPUT NAME="Ship2" SIZE=8 MAXLENGTH=8>&nbsp;&nbsp;&nbsp;&nbsp;WC Price:&nbsp;<INPUT NAME="Price2" SIZE=6 MAXLENGTH=8></TD>
</TR>

<TR><TD>&nbsp;</TD></TR>





<tr>
<td Class="stdFont"><br>Comments:</td>



<td><textarea name="Comment" cols="35" rows="6" WRAP="SOFT"></textarea></td>
</tr>


<TR>
<TD COLSPAN=2 ALIGN=center><br>
<INPUT TYPE=SUBMIT VALUE="Send Order">
<INPUT TYPE=RESET VALUE="Cancel">
</TD>
</TR>
</TABLE>
<br><br>


<CENTER><TABLE WIDTH="470" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD WIDTH="100%" Class="stdFonts"><CENTER>
&nbsp;</center>
</TD>
</TR>
</TABLE></CENTER>


</FORM>


</td></tr></table>



































<script language=JavaScript>
<!--

//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com

var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!docum ent.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document. onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontext menu=clickIE;}

document.oncontextmenu=new Function("return false")
// -->
</script>
</BODY>
</HTML>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-24-04, 08:42 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
Just add an if-statement in the Submitting function which checks to see if there is anything written in the first Model 2 box. if it's not, then just skip the validation for all the model 2 fields.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 05-24-04, 11:15 AM
Chris Hill Chris Hill is offline
Newbie Coder
 
Join Date: Mar 2004
Location: UK
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
or use return false; statements when you want things that have to be entered when you check them with the function, and then change the onSubmit to onSubmit="return function_name();"
__________________
<a href="http://www.WhiteHillStudios.co.uk/home.php" target="_blank">White Hill Studios</a> - driving down the cost of web design<br>
<a href="http://www.agscriptz.com" target="_blank">AG Scriptz ii: renaissance</a> - a new dawn or scripting
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
lock form fields using checkbox jonathen JavaScript 5 02-04-05 04:35 PM
formmail problem gscraper Perl 12 08-27-04 04:06 AM
displaying fields on the same form aliasgar ASP 1 01-22-04 01:50 PM
searching from a form where some fields are not required bobdole PHP 1 12-08-03 05:14 AM
passing array to hidden fields in form on next page? seala ASP 2 09-04-03 03:40 PM


All times are GMT -5. The time now is 02:03 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.