Link to home
Start Free TrialLog in
Avatar of richardwakefield
richardwakefield

asked on

Where is this form being validated?

I have a page on my e-commerce site mt_addproduct.asp which I use to add products to my product database. I have added 4 new fields (prodLink1 --> prodLink4) which are to be added to the database. When I try to submit the form without filling in all the fields I receive an error saying the fields prodLink1 prodLink2 prodLink3 and prodLink4 must be filled in. These fields aren't mandatory, so where is the code I need to change to stop them being mandatory (Javascript isn't my thing) :)

Thanks.

-----------------------------------------------------------------------------------------------------------------------------------------------------------
[mt_addproduct.asp]
-----------------------------------------------------------------------------------------------------------------------------------------------------------


<%
      Option Explicit
      Response.Buffer=True      
    Const vDebug = 0
    '--------------------------------------------------------------------
'@BEGINVERSIONINFO

'@APPVERSION: 50.1003.0.1

'@FILENAME: MT_AddProduct.asp
      
'@FILEVERSION: 1.0.1

'@VERSIONDATETIME: 2/21/01

'@DESCRIPTION:   web Admin tool

'@STARTCOPYRIGHT
'The contents of this file is protected under the United States
'copyright laws and is confidential and proprietary to
'LaGarde, Incorporated.  Its use or disclosure in whole or in part without the
'expressed written permission of LaGarde, Incorporated is expressly prohibited.
'
'(c) Copyright 2000, 2001 by LaGarde, Incorporated.  All rights reserved.
'@ENDCOPYRIGHT

'@ENDVERSIONINFO      
%>
`<SCRIPT language="javascript" src="../../SFLib/sfCheckErrors.js"></SCRIPT>
<SCRIPT language="javascript">
      var bAddProduct
      bAddProduct = false
      function newCategory() {
            if (window.document.openerForm.prodCategoryId.value == "New") {
                  window.document.openerForm.prodCategoryNewId.disabled = false
                  window.document.openerForm.prodCategoryNewId.value = ""
            }
            else {
                  window.document.openerForm.prodCategoryNewId.disabled = true
                  window.document.openerForm.prodCategoryNewId.value = "Select New Category"
            }      
      }
      function newMFG() {
            if (window.document.openerForm.prodManufacturerId.value == "New") {
                  window.document.openerForm.prodManufacturerNewId.disabled = false
                  window.document.openerForm.prodManufacturerNewId.value = ""
            }
            else {
                  window.document.openerForm.prodManufacturerNewId.disabled = true
                  window.document.openerForm.prodManufacturerNewId.value = "Select New Manufacturer"
            }      
      }
      function newVendor() {
            if (window.document.openerForm.prodVendorId.value == "New") {
                  window.document.openerForm.prodVendorNewId.disabled = false
                  window.document.openerForm.prodVendorNewId.value = ""
            }
            else {
                  window.document.openerForm.prodVendorNewId.disabled = true
                  window.document.openerForm.prodVendorNewId.value = "Select New Vendor"
            }      
      }
      function addproductCheck(form) {

      var sMes
            sMes=""
            var sExists
            var cnt            
            
            if (window.document.openerForm.prodCategoryId.options[window.document.openerForm.prodCategoryId.options.selectedIndex].value == "New") {
                        cnt=0
                  sExists=""

                  do
                  {
                  if (window.document.openerForm.prodCategoryId.options[cnt].text==window.document.openerForm.prodCategoryNewId.value)
                  {sExists="1"}
                  cnt+=1;
                  } while(cnt<window.document.openerForm.prodCategoryId.length);



                  if (sExists =="1"){
                        sMes=sMes+"Please fill in a unique category name.\n";
                        }
                  if (window.document.openerForm.prodCategoryNewId.value ==""){
                        sMes=sMes+"Please fill in new category name.\n";
                        }}
            if (window.document.openerForm.prodManufacturerId.options[window.document.openerForm.prodManufacturerId.options.selectedIndex].value == "New") {
                                    cnt=0
                  sExists=""

                  do
                  {
                  if (window.document.openerForm.prodManufacturerId.options[cnt].text==window.document.openerForm.prodManufacturerNewId.value)
                  {sExists="1"}
                  cnt+=1;
                  } while(cnt<window.document.openerForm.prodManufacturerId.length);



                  if (sExists =="1"){
                        sMes=sMes+"Please fill in a unique manufacturer name.\n";
                        }
                  if (window.document.openerForm.prodManufacturerNewId.value ==""){
                        sMes=sMes+"Please fill in a new manufacturer name.\n";
                        }}
            if (window.document.openerForm.prodVendorId.options[window.document.openerForm.prodVendorId.options.selectedIndex].value == "New")      {
                              cnt=0
                  sExists=""

                  do
                  {
                  if (window.document.openerForm.prodVendorId.options[cnt].text==window.document.openerForm.prodVendorNewId.value)
                  {sExists="1"}
                  cnt+=1;
                  } while(cnt<window.document.openerForm.prodVendorId.length);



                  if (sExists =="1"){
                        sMes=sMes+"Please fill in a unique vendor name.\n";
                        }

      
                  if (window.document.openerForm.prodVendorNewId.value =="")      {
                        sMes=sMes+"Please fill in new vendor name.\n"
                        }}

            if (sMes != "")      {
                  alert(sMes);
                  return false
                  }
            


var sName                        
            sName=window.document.openerForm.prodID.value;
            


            if (bAddProduct) {
                  if (sName.indexOf("'",0) >= 0){
                        window.alert("Product Name can not contain apostrophes.\n");
                        return false
                        }
                  else
                  {      
                  if (sfCheck(form)) {
                        return true;
                  }
                  else {
                        bAddProduct = false;
                        return false;
                  }}
            }
            else {
                  return true;
            }
      }
      function addProductClicked() {
            bAddProduct = true
      }
</SCRIPT>

<!--#include file="../SFLib/db.conn.open.asp"-->
<!--#include file="../SfLib/incGeneral.asp"-->
<!--#include file="../SFLib/ADOVBS.inc"-->
<!--#include file="MT_incadmin.asp"-->
<!--#include file="../SFLib/incDesign.asp"-->
<html>

<head>
<title>StoreFront Merchant Tools</title>
<SCRIPT language="javascript">
function helpMe(){
      var helpWin, loadHelp
      helpWin = window.open('help/prod_2.htm','helpWin', 'scrollbars=1,resizable,location=0,status=0,toolbar=0,menubar=0,height=300,width=500')
      helpWin.focus()
}      
</SCRIPT>
</head>

<%
dim prodID, prodCategoryId, prodManufacturerId, prodVendorId, prodName, prodDescription, prodMessage
dim prodImageSmallPath, prodImageLargePath, prodLink, prodLink1, prodLink2, prodLink3, prodLink4, prodPrice, prodWeight, prodShip, Output, choice0, choice1, choice2, choice
dim prodShipIsAct, prodCountryTaxIsAct, prodStateTaxIsAct, prodEnabledIsAct, addAttribute, attNumber
dim addAttType, attNumDetail, rsProdInput, rsProdAttGet, counter, tempVar, tempVarName, tempVarPrice
dim tempVarSet, counter2, tempVar3, SQL, tempPrice, prodSalePrice, prodSaleIsAct, prodShortDescription, prodNamePlural, selected
dim Cvalue, Mvalue, Vvalue, rsNewCat, rsNewMFG, rsNewVen, iBookMark
dim prodCategoryNewId, prodManufacturerNewId, prodVendorNewId
dim prodLength,prodHeight,prodWidth
'The page is devided into two area, confirmation area, and gathering input area

'Request all inputs            
prodID =              Trim(Request.Form("prodID"))
prodCategoryId =      Trim(Request.Form("prodCategoryId"))
prodManufacturerId =  Trim(Request.Form("prodManufacturerId"))
prodVendorId =        Trim(Request.Form("prodVendorId"))
prodCategoryNewId =      Trim(Request.Form("prodCategoryNewId"))
prodManufacturerNewId =  Trim(Request.Form("prodManufacturerNewId"))
prodVendorNewId =        Trim(Request.Form("prodVendorNewId"))
prodName =            Trim(Request.Form("prodName"))
prodNamePlural =      Trim(Request.Form("prodNamePlural"))
prodDescription =     Trim(Request.Form("prodDescription"))
prodShortDescription =Trim(Request.Form("prodShortDescription"))
prodMessage =         Trim(Request.Form("prodMessage"))
prodImageSmallPath =  Trim(Request.Form("prodImageSmallPath"))
prodImageLargePath =  Trim(Request.Form("prodImageLargePath"))
prodLink =            Trim(Request.Form("prodLink"))
prodLink1 =            Trim(Request.Form("prodLink1"))
prodLink2 =            Trim(Request.Form("prodLink2"))
prodLink3 =            Trim(Request.Form("prodLink3"))
prodLink4 =            Trim(Request.Form("prodLink4"))
prodPrice =           Trim(Request.Form("prodPrice"))
prodWeight =          Trim(Request.Form("prodWeight"))
if trim(prodWeight)="" then
prodWeight =          0
end if
      prodHeight =          Trim(Request.Form("prodHeight"))
      if trim(prodHeight)="" then
            prodHeight =          0
      end if
      prodWidth =          Trim(Request.Form("prodWidth"))
      if trim(prodWidth)="" then
            prodWidth =          0
      end if
      prodLength =          Trim(Request.Form("prodLength"))
      if trim(prodLength)="" then
            prodLength =          0
      end if

prodSalePrice =       Trim(Request.Form("prodSalePrice"))
prodSaleIsAct =       Trim(Request.Form("prodSaleIsAct"))
prodShip =            Trim(Request.Form("prodShip"))
prodShipIsAct =       Trim(Request.Form("prodShipIsAct"))
prodCountryTaxIsAct = Trim(Request.Form("prodCountryTaxIsAct"))
prodStateTaxIsAct =   Trim(Request.Form("prodStateTaxIsAct"))
prodEnabledIsAct =    Trim(Request.Form("prodEnabledIsAct"))
addAttribute =        Trim(Request.Form("addAttribute"))
attNumber =           Trim(Request.Form("attNumber"))
addAttType =          Trim(Request.Form("addAttType"))
attNumDetail =             Trim(Request.Form("attNumDetail"))

      'correct null data
      If prodShipIsAct="" Then
            prodShipIsAct= 0
      End If
      
      If prodCountryTaxIsAct="" Then
            prodCountryTaxIsAct= 0
      End If

      If prodStateTaxIsAct="" Then
            prodStateTaxIsAct= 0
      End If

      If prodEnabledIsAct="" Then
            prodEnabledIsAct= 0
      End If      
      
      If prodSaleIsAct="" Then
            prodSaleIsAct= 0
      End If      

'Confirmation and database insert area
If Request.Form("addproduct.x") <> "" Then
      If prodShip = "" Then prodShip = 0
      If prodSalePrice = "" Then prodSalePrice = 0
      If attNumber = "" Then attNumber = 0      
      If prodCategoryId = "New" Then
            Set rsNewCat = Server.CreateObject("ADODB.RecordSet")
            rsNewCat.CursorLocation = adUseClient
            rsNewCat.Open "sfCategories Order By catID", cnn, adOpenKeyset, adLockOptimistic, adCmdTable
            rsNewCat.AddNew
            rsNewCat.Fields("catName") = Trim(Request.Form("prodCategoryNewId"))
            rsNewCat.Update
            
            iBookMark = rsNewCat.AbsolutePosition
            rsNewCat.Requery
            rsNewCat.AbsolutePosition = iBookMark
            
            prodCategoryId = rsNewCat.Fields("catID")            
            rsNewCat.Close
            Set rsNewCat = nothing
      End If
      
      If prodManufacturerId = "New" Then
            Set rsNewMFG = Server.CreateObject("ADODB.RecordSet")
            rsNewMFG.CursorLocation = adUseClient
            rsNewMFG.Open "sfManufacturers Order By mfgID", cnn, adOpenKeyset, adLockOptimistic, adCmdTable
            rsNewMFG.AddNew
            rsNewMFG.Fields("mfgName") = Trim(Request.Form("prodManufacturerNewId"))
            rsNewMFG.Update
            
            iBookMark = rsNewMFG.AbsolutePosition
            rsNewMFG.Requery
            rsNewMFG.AbsolutePosition = iBookMark
            
            prodManufacturerId = rsNewMFG.Fields("mfgID")
            rsNewMFG.Close
            Set rsNewMFG = nothing
      End If
      
      If prodVendorId = "New" Then
            Set rsNewVen = Server.CreateObject("ADODB.RecordSet")
            rsNewVen.CursorLocation = adUseClient
            rsNewVen.Open "sfVendors Order By vendID", cnn, adOpenKeyset, adLockOptimistic, adCmdTable
            rsNewVen.AddNew
            rsNewVen.Fields("vendName") = Trim(Request.Form("prodVendorNewId"))
            rsNewVen.Update
            
            iBookMark = rsNewVen.AbsolutePosition
            rsNewVen.Requery
            rsNewVen.AbsolutePosition = iBookMark
            
            prodVendorId = rsNewVen.Fields("vendID")
            rsNewVen.Close
            Set rsNewVen = nothing
      End If
      
      'Input information into the database
      Set rsProdInput = Server.CreateObject("ADODB.RecordSet")
      rsProdInput.Open "sfProducts", cnn, adOpenDynamic, adLockOptimistic, adCmdTable
      
      On Error Resume Next

      rsProdInput.AddNew
      rsProdInput.Fields("prodID") = prodID
      rsProdInput.Fields("prodCategoryId") = prodCategoryId
      rsProdInput.Fields("prodManufacturerId") = prodManufacturerId
      rsProdInput.Fields("prodVendorId") = prodVendorId
      rsProdInput.Fields("prodName") = prodName
      rsProdInput.Fields("prodNamePlural") = prodNamePlural
      rsProdInput.Fields("prodDescription") = prodDescription
      rsProdInput.Fields("prodShortDescription") = prodShortDescription
      rsProdInput.Fields("prodMessage") = prodMessage
      rsProdInput.Fields("prodImageSmallPath") = prodImageSmallPath
      rsProdInput.Fields("prodImageLargePath") = prodImageLargePath
      
      rsProdInput.Fields("prodLink") = prodLink
      rsProdInput.Fields("prodLink1") = prodLink1
      rsProdInput.Fields("prodLink2") = prodLink2
      rsProdInput.Fields("prodLink3") = prodLink3
      rsProdInput.Fields("prodLink4") = prodLink4
                              
      rsProdInput.Fields("prodPrice") = prodPrice
      rsProdInput.Fields("prodWeight") = prodWeight
      rsProdInput.Fields("prodHeight")             = prodHeight
      rsProdInput.Fields("prodLength")             = prodLength
      rsProdInput.Fields("prodWidth")             = prodWidth

      rsProdInput.Fields("prodSalePrice") = prodSalePrice
      rsProdInput.Fields("prodSaleIsActive") = prodSaleIsAct
      rsProdInput.Fields("prodShip") = prodShip
      rsProdInput.Fields("prodShipIsActive") = prodShipIsAct
      rsProdInput.Fields("prodCountryTaxIsActive") = prodCountryTaxIsAct
      rsProdInput.Fields("prodStateTaxIsActive") = prodStateTaxIsAct
      rsProdInput.Fields("prodEnabledIsActive") = prodEnabledIsAct
'      rsProdInput.Fields("prodAttrNum") = attNumber
      rsProdInput.Fields("prodDateAdded") = Now()
      rsProdInput.Update
      rsProdInput.Close
                  
      rsProdInput.Open "sfAttributes", cnn, adOpenDynamic, adLockOptimistic, adCmdTable
      
      'Input Attribute Headers
      If Err.number = 0 Then
            counter = 1
            Do While Request.Form("T" & counter) <> ""
                  tempVar = "T" & counter
                  if trim(Request.Form(tempVar))<>"" then
                  rsProdInput.AddNew
                  rsProdInput.Fields("attrProdId") = prodID
                  rsProdInput.Fields("attrName") = Request.Form(tempVar)
                  rsProdInput.Update
                  end if
                  counter = counter + 1
            Loop
      
'+JF 9/27/01
            attNumber=counter-1
            rsProdInput.Close
      
      Set rsProdInput = Server.CreateObject("ADODB.RecordSet")      
      SQL = "SELECT * FROM sfProducts WHERE prodID = '" & prodID & "'"
      rsProdInput.Open SQL, cnn, adOpenDynamic, adLockOptimistic, adCmdText

      'Input base product information
      rsProdInput.Fields("prodAttrNum")         = attNumber
      rsProdInput.update
      rsProdInput.close
'-JF 9/27/01                  
            SQL = "SELECT attrID, attrName FROM sfAttributes WHERE attrProdId = '" & prodID & "'"
            Set rsProdAttGet = Server.CreateObject("ADODB.RecordSet")
            rsProdAttGet.Open SQL, cnn, adOpenForwardOnly, adLockOptimistic, adCmdText
      
            rsProdInput.Open "sfAttributeDetail", cnn, adOpenKeyset, adLockOptimistic, adCmdTable
      
            'Input Attribute Details
            counter = 1
            Do While Not rsProdAttGet.EOF
                  tempVar = "T" & counter
                  tempVarName = "N" & counter
                  tempVarPrice = "P" & counter
                  tempVarSet = "S" & counter
                  If Request.Form(tempVar) = rsProdAttGet.Fields("attrName") Then
                        counter2 = 1
                        Do While Request.Form(tempVarName & counter2) <> ""
                              if trim(Request.Form(tempVarName & counter2))<>"" then
                              rsProdInput.AddNew
                              rsProdInput.Fields("attrdtAttributeId") = rsProdAttGet.Fields("attrID")
                              rsProdInput.Fields("attrdtName") = Request.Form(tempVarName & counter2)
                              tempPrice = Request.Form(tempVarPrice & counter2)
                              If tempPrice = "" or isnull(tempPrice) Then
                                    rsProdInput.Fields("attrdtPrice") = "0"
                              Else
                                    rsProdInput.Fields("attrdtPrice") = tempPrice
                              End If
                              rsProdInput.Fields("attrdtType") = Request.Form(tempVarSet & counter2)
                              rsProdInput.Update
                              end if
                              counter2 = counter2 + 1
                        Loop
                        rsProdAttGet.MoveNext
                        counter = 1
                  Else
                        counter = counter + 1
                  End If
            Loop      
      
            rsProdInput.Close
            rsProdAttGet.Close
      
            Set rsProdInput = nothing
            Set rsProdAttGet = nothing
      End If
prodID =              ""
prodCategoryId =      ""
prodManufacturerId =  ""
prodVendorId =        ""
prodCategoryNewId =      ""
prodManufacturerNewId =  ""
prodVendorNewId =        ""
prodName =            ""
prodNamePlural =      ""
prodDescription =     ""
prodShortDescription =""
prodMessage =         ""
prodImageSmallPath =  ""
prodImageLargePath =  ""
prodLink =            ""
prodLink1 =            ""
prodLink2 =            ""
prodLink3 =            ""
prodLink4 =            ""
prodPrice =           ""
prodWeight =          "0"
prodHeight =          "0"
prodLength =          "0"
prodWidth =           "0"
prodSalePrice =       ""
prodSaleIsAct =       ""
prodShip =            ""
prodShipIsAct =       ""
prodCountryTaxIsAct = ""
prodStateTaxIsAct =   ""
prodEnabledIsAct =    ""
addAttribute =        ""
attNumber =           ""
addAttType =          ""
attNumDetail =             ""      
End If


%>      
<body background="<%= C_BKGRND %>" bgproperties="fixed" bgcolor="<%= C_BGCOLOR %>" link="<%= C_LINK %>" vlink="<%= C_VLINK %>" alink="<%= C_ALINK %>" onLoad="javascript:newCategory();newMFG();newVendor();">
<form method="post" name="openerForm" id="openerForm" onSubmit=""><%'JF 9/27/01%>
<table border="0" cellpadding="1" cellspacing="0" bgcolor="<%= C_BORDERCOLOR1 %>" width="<%= C_WIDTH %>" align="center">
<tr>
<td>
    <table width="100%" border="0" cellspacing="1" cellpadding="3">
    <tr>
<%      If C_BNRBKGRND = "" Then %>
<%      Else %>
<%      End If %>      
    </tr>
    <tr>
      <td align="middle" background="<%= C_BKGRND2 %>" bgcolor="<%= C_BGCOLOR2 %>">
    <b><font face="Tahoma" color="#FFFFFF" size="4">Blue Vinyl</font><font face="<%= C_FONTFACE2 %>" color="<%= C_FONTCOLOR2 %>" SIZE="<%= C_FONTSIZE2 %>"> Merchant Tools</font></b></td>        
    </tr>
      <tr>
      <td bgcolor="<%= C_BGCOLOR3 %>" background="<%= C_BKGRND3 %>" width="100%" > 
      
             <table border="0" width="100%">
        <tr>
        <td width="83%"><b>
        <font face="<%= C_FONTFACE3 %>" color="<%= C_FONTCOLOR3 %>" SIZE="<%= C_FONTSIZE3+1 %>">Store Inventory: Add A Product</font></b>
        <td width="17%" align="right">
        <A HREF="javascript:helpMe()"><img src=images/help.jpg alt="Help" border="0"></A></td>
        </tr>
        </table>
   
         <tr>
      <td bgcolor="<%= C_BGCOLOR4 %>" background="<%= C_BKGRND4 %>" width="100%">
   
<%
If Err.number <> 0 Then
'If Err.number = 3705 Then
%>

      

                        <table cellpadding="5" cellspacing="0" bgcolor="<%= C_BGCOLOR4 %>" width="100%">
                        <tr><td width="100%" bgcolor="<%= C_BGCOLOR4 %>" align="center" background="<%= C_BKGRND5 %>">
                        <b><font face="<%= C_FONTFACE5 %>" color="#FF0000" size="<%= C_FONTSIZE5+2 %>"><b>Database Error
                        </font></b>
                        <br>
                        <b><font face="<%= C_FONTFACE5 %>" color="#FF0000" size="<%= C_FONTSIZE5 %>">Error Number= <%= Err.number%><br>Error Description= <%= Err.description %>
                        </td></tr>
                        </table>

<%
'End If
End If
If Request.Form("addproduct.x") <> "" And Err.number = 0 Then
%>
                        <table cellpadding="5" cellspacing="0" bgcolor="<%= C_BGCOLOR4 %>" width="100%">
                        <tr><td width="100%" bgcolor="<%= C_BGCOLOR4 %>" align="center" background="<%= C_BKGRND5 %>">
                        <b><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4+2 %>"><b>Database Updated
                        </font>
                        <br><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>"><a href="Menu.asp">Return to Merchant Tools</b></a>
                        </font></b>
                        </td></tr>
                        </table>


<%End If%>

   
        <table width="100%">
        <tr>
        <td width="100%" colspan="2" bgcolor="<%= C_BGCOLOR5 %>" background="<%= C_BKGRND5 %>" height="19"><b><font face="<%= C_FONTFACE5 %>" color="<%= C_FONTCOLOR5 %>" size="<%= C_FONTSIZE5 %>">
        General Product Information</font></b></td>
        </tr>
        <tr>
        <td width="50%" align="right" height="22"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Product ID:</font></td>
        <td width="50%" height="22">
        <input type="text" name="prodID" title="Product ID" size="20" style="<%= C_FORMDESIGN %>" value="RCD"></td>
        </tr>
        <tr>
        <td width="50%" align="right" height="22"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Product Name:</font></td>
        <td width="50%" height="22"><input type="text" name="prodName" title="Product Name" value="<%= prodName %>" size="20" style="<%= C_FORMDESIGN %>"></td>
        </tr>
        <tr>
        <td width="50%" align="right" height="22"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Product Name Plural:</font></td>
        <td width="50%" height="22"><input type="text" name="prodNamePlural" title="Product Name Plural" value="<%= prodNamePlural %>" size="20" style="<%= C_FORMDESIGN %>"></td>
        </tr>
        <tr>
        <td width="50%" align="right" height="22"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Product
        Label:</font></td>
        <td width="50%" height="22"><select size="1" name="prodCategoryId" style="<%= C_FORMDESIGN %>" onChange="javascript:newCategory()">
        <%
        If prodCategoryId <> "New" Then
                  Response.write getCategoryList(prodCategoryId)
                  selected = ""
            Else
                  Response.write getCategoryList(0)
                  selected = "selected"
                  Cvalue= Request.Form("prodCategoryNewId")
            End If
        %><option <%= selected %> value="New">New Label</select><input type="text" name="prodCategoryNewId" value="<%= Cvalue %>" style="<%= C_FORMDESIGN %>" size=18></input></td>
        </tr>
        <tr>
        <td width="50%" align="right" height="22"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Product
          Category:</font></td>
        <td width="50%" height="22"><select size="1" name="prodManufacturerId" style="<%= C_FORMDESIGN %>" onChange="javascript:newMFG()">
        <%
        If prodManufacturerId <> "New" Then
            Response.write getManufacturersList(prodManufacturerId)
            selected = ""
        Else
                  Response.Write getManufacturersList(0)
                  selected = "selected"
                  Mvalue = Request.Form("prodManufacturerNewId")
            End If
        %><option <%= selected %> value="New">New Category</select><input type="text" name="prodManufacturerNewId" value="<%= Mvalue %>" style="<%= C_FORMDESIGN %>" size=18></input></td>
        </td>
        </tr>
        <tr>
        <td width="50%" align="right" height="22"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Product
          Vendor:</font></td>
        <td width="50%" height="22"><select size="1" name="prodVendorId" style="<%= C_FORMDESIGN %>" onChange="javascript:newVendor()">
        <%
        If prodVendorId <> "New" Then
            Response.write getVendorList(prodVendorId)
            selected = ""
        Else
                  Response.Write getVendorList(0)
                  selected = "selected"
                  Vvalue = Request.Form("prodVendorNewId")
            End If
        %><option <%= selected %> value="New">New Vendor</select><input type="text" name="prodVendorNewId" value="<%= Vvalue %>" style="<%= C_FORMDESIGN %>" size=18></input></td>
          </select>
        </td>
        </tr>
        <tr>
        <td width="50%" align="right" height="23"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Product Price:</font></td>
        <td width="50%" height="23"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>"><input type="text" name="prodPrice" title="Product Price" value="<%= prodPrice%>" size="20" style="<%= C_FORMDESIGN %>">
        </font>
        </td>
        </tr>
        <tr>
        <td width="50%" align="right" valign="top" nowrap height="36"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Product Short Description :<br><font size="-1">(used on search.asp)</font></td>
        <td width="50%" height="36"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>"><textarea rows="2" name="prodShortDescription" title="Product Short Description" cols="30" style="<%= C_FORMDESIGN %>"><%= prodShortDescription %></textarea>
        </font>
        </td>
        </tr>
        <tr>
        <td width="50%" align="right" valign="top" height="68"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Product Long Description :<br><font size="-1">(used on detail.asp)</font></font></td>
        <td width="50%" height="68"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>"><textarea rows="4" name="prodDescription" cols="30" style="<%= C_FORMDESIGN %>"><%= prodDescription %></textarea>
        </font>
        </td>
        </tr>
        <tr>
        <td width="50%" align="right" height="23"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Confirmation Message:</font></td>
        <td width="50%" height="23"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>"><input type="text" name="prodMessage" title="Product Message" value="<%= prodMessage%>" size="30" style="<%= C_FORMDESIGN %>">
        </font>
        </td>
        </tr>
        <tr>
        <td width="50%" align="right" height="7" valign="top"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Link:</font></td>
        <td width="50%" height="7"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">
        <input type="text" name="prodLink" size="30" style="<%= C_FORMDESIGN %>" value="<%= prodLink%>">
        </font>
            </td>
        </tr>
        <tr>
        <td width="50%" align="right" height="4" valign="top"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Link1:</font></td>
        <td width="50%" height="4"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">
        <input type="text" name="prodLink1" size="30" style="<%= C_FORMDESIGN %>" value="<%= prodLink1%>"></font></td>
        </tr>
        <tr>
        <td width="50%" align="right" height="4" valign="top"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Link2:</font></td>
        <td width="50%" height="4"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">
        <input type="text" name="prodLink2" size="30" style="<%= C_FORMDESIGN %>" value="<%= prodLink2%>"></font></td>
        </tr>
        <tr>
        <td width="50%" align="right" height="4" valign="top"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Link3:</font></td>
        <td width="50%" height="4"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">
        <input type="text" name="prodLink3" size="30" style="<%= C_FORMDESIGN %>" value="<%= prodLink3%>"></font></td>
        </tr>
        <tr>
        <td width="50%" align="right" height="4" valign="top"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Link4:</font></td>
        <td width="50%" height="4"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">
        <input type="text" name="prodLink4" size="30" style="<%= C_FORMDESIGN %>" value="<%= prodLink4%>"></font></td>
        </tr>
        <tr>
        <td width="50%" align="right" height="23"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Product Weight:</font></td>
        <td width="50%" height="23"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">
        <input type="text" name="prodWeight" title="Product Weight" size="20" style="<%= C_FORMDESIGN %>" value="0.">
        </font>
        </td>
        </tr>
        <tr>
        <td width="50%" align="right"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Product Length:</font></td>
        <td width="50%"><font face="Verdana" size="2"><input type="text" title="Product Length" name="prodLength" value="<%= prodLength%>" size="20" style="<%= C_FORMDESIGN %>">
        </font>
        </td>
        </tr>
        <tr>
        <td width="50%" align="right"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Product Width:</font></td>
        <td width="50%"><font face="Verdana" size="2"><input type="text" title="Product Width" name="prodWidth" value="<%= prodWidth%>" size="20" style="<%= C_FORMDESIGN %>">
        </font>
        </td>
        </tr>
        <tr>
        <td width="50%" align="right"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Product Height:</font></td>
        <td width="50%"><font face="Verdana" size="2"><input type="text" title="Product Height" name="prodHeight" value="<%= prodHeight%>" size="20" style="<%= C_FORMDESIGN %>">
        </font>
        </td>
        </tr>
       
        <tr>
        <td width="50%" align="right" height="20"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Activate Product:</font></td>
        <%If Request.Form("prodEnabledIsAct") = "" or Request.Form("addproduct.x") <> "" Then %>
            <td width="50%" height="20">
        <input type="checkbox" name="prodEnabledIsAct" value="1" checked></td>
            <%Else%>
            <td width="50%" height="20"><input type="checkbox" name="prodEnabledIsAct" value="1" checked></td>
            <%End If%>
        </tr>
        <tr>
            <td colspan="2">&nbsp;  
            </td>
            </tr>
        <tr>
        <td width="100%" colspan="2" bgcolor="<%= C_BGCOLOR5 %>" background="<%= C_BKGRND5 %>"><b><font face="<%= C_FONTFACE5 %>" color="<%= C_FONTCOLOR5 %>" size="<%= C_FONTSIZE5 %>">
        Attributes</font></b></td>
        </tr>
        <tr>
        <td width="100%" colspan="2">
        <table width="100%" border="0">
        <%
            'Gathers Attribute information and displayes in correct HTML format
            addAttribute = Request.Form("AddAttribute.x")
            If addAttribute <> "" or addAttType = "Options" or Request.Form("actionType") = "Add Product" Then
                  If attNumber = "" and Request.Form("actionType") <> "Add Product" Then 'First Instance of Attribute being added
            %>
            <tr><td colspan="2"><hr></td></tr><tr><td align="right" nowrap><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 + 1 %>">Attribute Title: </td><td><input type="text" title="Attribute Title" name="T1" size="15" style="<%= C_FORMDESIGN %>" optional=true></td></tr>
            <tr><td align="center" colspan="2"><input type="submit" name="addAttType" value="Options"></td></tr><input type="hidden" name="attNumber" value="1">
            <%            
                  Else
                        counter = 1
                        Do While Request.Form("T" & counter) <> "" 'Loop which gathers Attribute Titles already added
                              tempVar = "T" & counter
                              tempVarName = "N" & counter
                              tempVarPrice = "P" & counter
                              tempVarSet = "S" & counter
            %>
            <tr><td colspan="2"><hr></td></tr><tr><td align="right" nowrap><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 + 1 %>">Attribute Title: </td><td><input type="text" title="Attribute Title <%= counter %>" name="T<%= counter %>" value="<%= Request.Form(tempVar) %>" size="15" style="<%= C_FORMDESIGN %>" optional=true></td></tr>
            <%                  
                              counter2 = 1
                              Do While Request.Form(tempVarName & counter2) <> "" 'Loop which gathers Attribute Options
            %>
            <tr><td align="right"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Option <%= counter2 %>: </td><td nowrap><input type="text" title="Option <%= tempVarName & counter2 %>" name="<%= tempVarName & counter2 %>" value="<%= Request.Form(tempVarName & counter2) %>" size="10" style="<%= C_FORMDESIGN %>" optional=true>
            <%
                                    choice = Request.Form(tempVarSet & counter2)
                                    choice0 = ""
                                    choice1 = ""
                                    choice2 = ""
                                    If choice = "0" Then
                                          choice0 = "checked"
                                    ElseIf choice = "1" Then
                                          choice1 = "checked"
                                    ElseIf choice = "2" Then
                                          choice2 = "checked"
                                    End If
            %>
                                          <font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">
                                          <input type="radio" <%=choice0%> name="<%= tempVarSet & counter2 %>" value="0">Same Price
                                          <input type="radio" <%=choice1%> name="<%= tempVarSet & counter2 %>" value="1">Increase
                                          <input type="radio" <%=choice2%> name="<%= tempVarSet & counter2 %>" value="2">Decrease by:
            <%
                                    
                                    If choice = "0" OR Request.Form(tempVarPrice & counter2) = "" Then
                                          tempVar3 = "0"
                                    Else
                                          tempVar3 = Request.Form(tempVarPrice & counter2)
                                    End If
            %>
                                    <input type="text" title="Option Price <%= counter2 %>" name="<%= tempVarPrice & counter2 %>" value="<%= tempVar3 %>" size="3" style="<%= C_FORMDESIGN %>" optional=true number=true></td></tr>
            <%
                                    counter2 = counter2 + 1
                              Loop
                              counter = counter + 1
                        Loop 'The Loops above only gather information already added
                        If addAttType = "Options"  and trim(Request.Form("T1")) <> "" Then 'If Statement addeds correct input field for new Option or Attribute Title
            %>
                              <tr><td align="right" nowrap><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>"> Option <%= counter2 %>: </td>
                              <td nowrap><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">
                              <input type="text" title="Option <%= counter2 %>" name="<%= tempVarName & counter2 %>" size="10" style="<%= C_FORMDESIGN %>" optional=true>
                              <input type="radio" checked name="<%= tempVarSet & counter2 %>" value="0">Same Price
                              <input type="radio" name="<%= tempVarSet & counter2 %>" value="1">Increase
                              <input type="radio" name="<%= tempVarSet & counter2 %>" value="2">Decrease by:
                              <input type="text" title="Option Price <%= counter2 %>" number=true name="<%= tempVarPrice & counter2 %>" size="3" style="<%= C_FORMDESIGN %>" optional=true value="0"></td></tr>
                              <tr><td align="center" colspan="2"><input type="submit" name="addAttType" value="Options"></td></tr>
                              <input type="hidden" name="attNumber" value="<%= counter-1 %>">
            <%
                        ElseIf addAttribute <> "" Then
            %>
                              <tr><td colspan="2"><hr></td></tr>
                              <tr><td align="right" noWrap><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Attribute Title: </td>
                              <td><input type="text" title="Attribute Title <%= counter %>"name="T<%=  counter %>" size="15" style="<%= C_FORMDESIGN %>"></tr></td>
                              <tr><td align="center" colspan="2">
                              <input type="submit" name="addAttType" value="Options"></td></tr><input type="hidden" name="attNumber" value="<%= counter %>"> <%'JF%>
            <%
                        End If      
                  End If
            End If
            %>
            </table>
            </td>
            </tr>
        <tr>
        <td width="100%" colspan="2" align="center" height="21"><input type="image" name="AddAttribute" border="0" src="images/addattr.gif" height="21"></td>
        </tr>
        <tr>
            <td colspan="2" height="19">&nbsp;  
            </td>
            </tr>
        <tr>
        <td width="100%" colspan="2" bgcolor="<%= C_BGCOLOR5 %>" background="<%= C_BKGRND5 %>" height="19"><b><font face="<%= C_FONTFACE5 %>" color="<%= C_FONTCOLOR5 %>" size="<%= C_FONTSIZE5 %>">
        Images</font></b></td>
        </tr>
        <tr>
        <td width="50%" height="42"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Product Small Image<br>
          <input type="text" name="prodImageSmallPath" size="20" style="<%= C_FORMDESIGN %>">
        </font>
        </td>
        <td width="50%" height="42"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Product Large Image<br>
          <input type="text" name="prodImageLargePath" value="<%= prodImageLargePath%>" size="20" style="<%= C_FORMDESIGN %>">
        </font>
        </td>
        </tr>
        <tr>
            <td colspan="2" height="19">&nbsp;  
            </td>
            </tr>
        <tr>
        <td width="100%" colspan="2" bgcolor="<%= C_BGCOLOR5 %>" background="<%= C_BKGRND5 %>" height="19"><b><font face="<%= C_FONTFACE5 %>" color="<%= C_FONTCOLOR5 %>" size="<%= C_FONTSIZE5 %>">
        Sale Options</font></b></td>
        </tr>
        <tr>
        <%If Request.Form("prodSaleIsAct") = "1" and Request.Form("addproduct.x")="" Then 'checks the correct option%>
                  <td width="50%" height="42"><input type="checkbox" name="prodSaleIsAct" value="1" checked>
            <%Else%>
                  <td width="50%" height="42"><input type="checkbox" name="prodSaleIsAct" value="1">
            <%End If%>
            <font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Activate Sale&nbsp;</font></td>
        <td width="50%" height="42"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Sale Price<br>
          <input type="text" title="Product Sale Price" name="prodSalePrice" value="<%= prodSalePrice%>" size="20" style="<%= C_FORMDESIGN %>">
          </font></td>
        </tr>
        <tr>
            <td colspan="2" height="19">&nbsp;  
            </td>
            </tr>
        <tr>
        <td width="100%" colspan="2" bgcolor="<%= C_BGCOLOR5 %>" background="<%= C_BKGRND5 %>" height="19"><b><font face="<%= C_FONTFACE5 %>" color="<%= C_FONTCOLOR5 %>" size="<%= C_FONTSIZE5 %>">
        Shipping Options</font></b></td>
        </tr>
        <tr>
        <%If Request.Form("prodShipIsAct") = "1" and Request.Form("addproduct.x")="" Then 'checks the correct option%>
                  <td width="50%" height="42"><input type="checkbox" name="prodShipIsAct" value="1" checked>
            <%Else%>
                  <td width="50%" height="42">
            <input type="checkbox" name="prodShipIsAct" value="1" checked>
            <%End If%>
            <font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Activate Shipping&nbsp;</font></td>
        <td width="50%" height="42"><font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Shipping Cost<br>
          <input type="text" title="Product Ship Price" name="prodShip" value="<%= prodShip%>" size="20" style="<%= C_FORMDESIGN %>">
          </font></td>
        </tr>
        <tr>
            <td colspan="2" height="19">&nbsp;  
            </td>
            </tr>
        <tr>
        <td width="100%" colspan="2" bgcolor="<%= C_BGCOLOR5 %>" background="<%= C_BKGRND5 %>" height="19"><b><font face="<%= C_FONTFACE5 %>" color="<%= C_FONTCOLOR5 %>" size="<%= C_FONTSIZE5 %>">
        Tax Options</font></b></td>
        </tr>
        <tr>
        <%If Request.Form("prodStateTaxIsAct") = "1" and Request.Form("addproduct.x")="" Then'checks the correct option%>
                  <td width="50%" height="77"><input type="checkbox" name="prodStateTaxIsAct" value="1" checked>
            <%Else%>
                  <td width="50%" height="77"><input type="checkbox" name="prodStateTaxIsAct" value="1">
            <%End If%>
            <font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Activate State Tax</font></td>
        <%If Request.Form("prodCountryTaxIsAct") = "1" and Request.Form("addproduct.x")="" Then'checks the correct option%>
                  <td width="50%" height="77"><input type="checkbox" name="prodCountryTaxIsAct" value="1" checked>
            <%Else%>
                  <td width="50%" height="77"><input type="checkbox" name="prodCountryTaxIsAct" value="1">
            <%End If%>
            <font face="<%= C_FONTFACE4 %>" color="<%= C_FONTCOLOR4 %>" size="<%= C_FONTSIZE4 %>">Activate Country Tax</font></td>
        </tr>
        <tr>
            <td colspan="2" height="19">&nbsp;  
            </td>
            </tr>
        <tr>
            <td align="center" width="100%" colspan="2" height="21"><b><font face="<%= C_FONTFACE5 %>" color="<%= C_FONTCOLOR5 %>" size="<%= C_FONTSIZE5 %>"><input type="image" name="addproduct" src="images/addproduct.gif" border="0" WIDTH="108" HEIGHT="21" onClick="javascript:addProductClicked();javascript:window.document.openerForm.prodImageSmallPath.optional=true;window.document.openerForm.prodImageLargePath.optional=true;window.document.openerForm.prodLink.optional=true;window.document.openerForm.prodShip.number=true;window.document.openerForm.prodSalePrice.number=true;window.document.openerForm.prodWeight.number=true;window.document.openerForm.prodPrice.number=true;window.document.openerForm.prodNamePlural.optional=true;window.document.openerForm.prodMessage.optional=true;window.document.openerForm.prodWeight.optional=true;window.document.openerForm.prodDescription.optional=true;window.document.openerForm.prodSalePrice.optional=true;window.document.openerForm.prodCategoryNewId.optional=true;window.document.openerForm.prodManufacturerNewId.optional=true;window.document.openerForm.prodVendorNewId.optional=true;return addproductCheck(window.document.openerForm)"></td>
            </tr>
        </table><br>
    </td>
    </tr>
          <tr>
            <td bgcolor="<%= C_BGCOLOR7 %>" background="<%= C_BKGRND7 %>"><font face="<%= C_FONTFACE7 %>" color="<%= C_FONTCOLOR7 %>" size="<%= C_FONTSIZE7 %>"><p align="center"><b><a href="MT_MenuInv.asp">Store Inventory</a> | <a href="Menu.asp">Merchant Tools Home</a> | <a href="../../search.asp"><%= C_STORENAME %></a></b></font></p></td>
        </tr>
</table>
</td>
</tr>
</table>
</form>
<%'+JF 9/28/01%>
<script language="javascript" name=script2>

      if (window.document.openerForm.prodCategoryId.options[window.document.openerForm.prodCategoryId.options.selectedIndex].value == "New") {
                  window.document.openerForm.prodCategoryNewId.disabled = false
//                  window.document.openerForm.prodCategoryNewId.value = ""
            }
            else {
                  window.document.openerForm.prodCategoryNewId.disabled = true
                  window.document.openerForm.prodCategoryNewId.value = "Select New Category"
            }
      
            if (window.document.openerForm.prodManufacturerId.options[window.document.openerForm.prodManufacturerId.options.selectedIndex].value == "New") {
                  window.document.openerForm.prodManufacturerNewId.disabled = false
//                  window.document.openerForm.prodManufacturerNewId.value = ""
            }
            else {
                  window.document.openerForm.prodManufacturerNewId.disabled = true
                  window.document.openerForm.prodManufacturerNewId.value = "Select New Manufacturer"
            }
            if (window.document.openerForm.prodVendorId.options[window.document.openerForm.prodVendorId.options.selectedIndex].value == "New") {
                  window.document.openerForm.prodVendorNewId.disabled = false
//                  window.document.openerForm.prodVendorNewId.value = ""
            }
            else {
                  window.document.openerForm.prodVendorNewId.disabled = true
                  window.document.openerForm.prodVendorNewId.value = "Select New Vendor"
            }
      
</script>
<%'-JF 9/28/01%>

</body>

</html>



Here is the sfcheckerrors.js file which is called at the beginning:

-----------------------------------------------------------------------------------------------------------------------------------------------------------
sfcheckerrors.js
-----------------------------------------------------------------------------------------------------------------------------------------------------------
//@BEGINVERSIONINFO

//@APPVERSION: 50.4013.0.2

//@FILENAME: sfcheckerrors.asp
      


//@DESCRIPTION: Checkes sfErrors

//@STARTCOPYRIGHT
//The contents of this file is protected under the United States
//copyright laws as an unpublished work, and is confidential and proprietary to
//LaGarde, Incorporated.  Its use or disclosure in whole or in part without the
//expressed written permission of LaGarde, Incorporated is expressly prohibited.

//(c) Copyright 2000 by LaGarde, Incorporated.  All rights reserved.
//@ENDCOPYRIGHT

//@ENDVERSIONINFO

function specialCase(e, form) {
      if ((e.name == "CardName")||(e.name == "CardNumber")||(e.name == "CardExpiryMonth")||(e.name == "CardExpiryYear")) {
            if (((form.CardName.value.length <= 0)||(form.CardNumber.value.length <= 0)||(form.CardExpiryMonth.value.length <= 0)||(form.CardExpiryYear.value.length <= 0))
             && ((form.CardName.value.length > 0)||(form.CardNumber.value.length > 0)||(form.CardExpiryMonth.value.length > 0)||(form.CardExpiryYear.value.length > 0))) {
                  return "Please enter all Credit Card Information.";
            }
            if ((form.CardName.value.length > 0)&&(form.CardNumber.value.length > 0)&&(form.CardExpiryMonth.value.length > 0)&&(form.CardExpiryYear.value.length > 0)) {
                  if (!isCardDateValid(form.CardExpiryYear.value, form.CardExpiryMonth.value)) {
                        return "The Credit Card has Expired.";
                  }
                  if (isCardNumValid(form.CardNumber.value)) {
                        return "The Credit Card Number is an invalid format.";
                  }
            }
      }
      if ((e.name == "CheckNumber")||(e.name == "BankName")||(e.name == "RoutingNumber")||(e.name == "CheckingAccountNumber")) {
            if (((form.CheckNumber.value.length <= 0)||(form.BankName.value.length <= 0)||(form.RoutingNumber.value.length <= 0)||(form.CheckingAccountNumber.value.length <= 0))
             && ((form.CheckNumber.value.length > 0)||(form.BankName.value.length > 0)||(form.RoutingNumber.value.length > 0)||(form.CheckingAccountNumber.value.length > 0))) {
                  return "Please enter all eCheck Information.";
            }            
      }
      if ((e.name == "POName")||(e.name == "PONumber")) {
            
            if (((form.POName.value.length <= 0)||(form.PONumber.value.length <= 0))
             && ((form.POName.value.length > 0)||(form.PONumber.value.length > 0))) {
                  return "Please enter all Purchase Order Information.";
            }
      }
      if ((form.CardName.value.length <= 0)&&(form.CardNumber.value.length <= 0)&&(form.CardExpiryMonth.value.length <= 0)&&(form.CardExpiryYear.value.length <= 0)
       && (form.CheckNumber.value.length <= 0)&&(form.BankName.value.length <= 0)&&(form.RoutingNumber.value.length <= 0)&&(form.CheckingAccountNumber.value.length <= 0)
       && (form.POName.value.length <= 0)&&(form.PONumber.value.length <= 0)) {
            return "Please enter payment method Information.";      
      }
      return "";
}
function stripChar(sValue, sChar) {
      var i, tempChar, buildString;
      buildString = ""
      for (var i=0; i<sValue.length; i++) {
            tempChar = sValue.charAt(i);
            if (tempChar != sChar) {
                  buildString = buildString + tempChar;
            }
      }
      return buildString;
}

function isCardDateValid(year, month) {
      var dateCheck, now;
      if (year.length == 2) {
            if (parseInt(year) < 50) {
                  year = "20" + year;
            }
      }
      now = new Date();
      dateCheck = new Date(year, month);
      if (now > dateCheck) {
            return false;
      }
      else {
            return true;
      }
}

function isCardNumValid(num) {
      var num1, num2, tempNum;
      if (!isNumber(num)) {
            return true;
      }
      num1 = ""
      if (!(num.length%2==0)) {
            for(var j=0; j < num.length; j++) {
                  if ((j+1)%2==0){
                        tempNum = 2 * num.charAt(j);
                  }
                  else {
                        tempNum = 1 * num.charAt(j);
                  }
                  num1 = num1 + tempNum.toString();
            }
      }
      else{
            for(var j=0; j < num.length; j++){
                  if ((j+1)%2==0){
                        tempNum = 1 * num.charAt(j);
                  }
                  else{
                        tempNum = 2 * num.charAt(j);
                  }
                  num1 = num1 + tempNum.toString();
            }
      }
      num2 = 0;
      for (var j = 0; j < num1.length; j++) {
            num2 = num2 + parseInt(num1.charAt(j));
      }
      if (num2%10==0) {
            return false;
      }
      else {
            return true;
      }
}

function isNumber(value) {
      for (var i=0; i < value.length; i++) {
            a = parseInt(value.charAt(i));
            if (isNaN(a)) {
                  return false;                  
                  break;
            }
      }
      return true;
}

function sfCheck(form) {
      var e, title, empty_fields, char_check, invalid_card, month, year, invalid_date, eMail, invalid_eMail
      var iQuantity, quantity_check, checkSpecial, tempError, special_Error, msg, upperLine, lowerLine
      var num, invalid_phoneNumber, passwd_mismatch
      msg = "";
      empty_fields = "";
      char_check = "";
      special_Error = "";
      tempError = "";
      num = form.length
      for (var i = 0; i < form.length; i++) {
            e = form.elements[i]
            if ((e.title == null)||(e.title == "")) {
                  title = e.name;
            }
            else {
                  title = e.title;
            }
            if (((e.type == "text") || (e.type == "textarea")||(e.type == "password")) && !e.special && !e.disabled) {
                  if (e.value.length <= 0 && !e.optional && (e.name.indexOf("Ship") == -1)) {
                        empty_fields += "\n            " + title;
                        continue;
                  }
                  if (e.number) {
                        num = e.value;
                        num = stripChar(num, ".");
                        num = stripChar(num, ",");
                        if (!isNumber(num)) {
                              char_check += "\n             " + title;
                        }
                  }
                  if (e.creditCardNumber) {
                        e.value = stripChar(e.value, " ");
                        e.value = stripChar(e.value, "-");
                        invalid_card = isCardNumValid(e.value);
                  }
                  
                  if ((e.creditCardExpMonth)||(e.creditCardExpYear)) {
                        if (e.creditCardExpMonth) {
                              month = e.value;
                              month = stripChar(month, " ")
                              if (!isNumber(month)) {
                                    invalid_date = true;
                                    month = null;
                              }
                        }
                        if (e.creditCardExpYear) {
                              year = e.value;
                              year = stripChar(year, " ")
                              if (!isNumber(year)) {
                                    invalid_date = true;
                                    year = null;
                              }
                        }
                        if ((month != null) && (year != null)) {
                              if(!isCardDateValid(year, month)) {
                                    invalid_date = true;
                              }      
                        }
                  }
                  if (e.eMail) {
                        eMail = e.value;
                        if ((eMail.indexOf("@") != -1) && (eMail.indexOf(".") != -1)) {
                              invalid_eMail = false;
                        }
                        else {
                              invalid_eMail = true;
                        }
                  }
                        if (e.name == "txtEmail") {
                        eMail = e.value;
                        if ((eMail.indexOf("@") != -1) && (eMail.indexOf(".") != -1)) {
                              invalid_eMail = false;
                        }
                        else {
                         
                              invalid_eMail = true;
                        }
                  }      
                  if (e.name == "txtFriend") {
                        eMail = e.value;
                        if ((eMail.indexOf("@") != -1) && (eMail.indexOf(".") != -1)) {
                              invalid_eMail = false;
                        }
                        else {
                         
                              invalid_eMail = true;
                        }
                  }      

                  if (e.phoneNumber) {
                        num = e.value;
                        num = stripChar(num, " ");
                        num = stripChar(num, "-");
                        num = stripChar(num, "+");
                        if (num.length < 10) {
                              invalid_phoneNumber = true;
                        }      
                  }
            }
            if (e.quantityBox) {
                  iQuantity = e.value;
                  if (!isNumber(iQuantity)) {
                        quantity_check = true;
                  }
                  if (parseInt(iQuantity) < 0) {
                        quantity_check = true;
                  }
                  if ((iQuantity) < 1) {
                        quantity_check = true;
                  }

            }
            if (e.password) {
                  if (form.Password.value != form.Password2.value) {
                              passwd_mismatch = true;
                  }
            }
            if (e.special) {
                  checkSpecial = specialCase(e, form);
                  if (tempError != checkSpecial) {
                        special_Error = special_Error + checkSpecial
                  }
                  tempError = checkSpecial;
            }
            if (e.type == "select-one" && !e.optional) {
                  if (e.value == "") {
                        empty_fields += "\n            " + title;
                        continue;
                  }
            }
      }
      
      if (!empty_fields && !char_check && !special_Error && !invalid_card && !invalid_date && !invalid_eMail && !quantity_check && !invalid_phoneNumber && !passwd_mismatch) {return true}
      
      msg = "The form was not submited due to the following error(s).\n";
      
      upperLine = "\n_________________________________________________________\n\n";
      lowerLine = "_________________________________________________________\n";
      
      if (empty_fields) {
            msg += upperLine;
            msg += "The following field(s) must be filled in:\n";
            msg += lowerLine;
            msg += empty_fields;
      }
      if (char_check) {
            msg += upperLine;
            msg += "The following field(s) need a numeric value:\n";
            msg += lowerLine;
            msg += char_check;
      }
      if (quantity_check) {
            msg += upperLine;
            msg += "Please Enter a Positive Integer.\n"
            msg += lowerLine;
      }
      if (invalid_card) {
            msg += upperLine;
            msg += "The Credit Card Number is an invalid format.\n";
            msg += lowerLine;
      }
      if (invalid_date) {
            msg += upperLine;
            msg += "The Credit Card has Expired.\n";
            msg += lowerLine;
      }
      if (invalid_eMail) {
            msg += upperLine;
            msg += "The Email Address is in an invalid format.\n";
            msg += lowerLine;
      }
      if (invalid_phoneNumber) {
            msg += upperLine;
            msg += "Please enter a valid Phone Number with area code.\n";
            msg += lowerLine;
      }
      if (special_Error) {
            msg += upperLine;
            msg += special_Error + "\n";
            msg += lowerLine;
      }
      if (passwd_mismatch) {
            msg += upperLine;
            msg += "Your passwords did not match. Please enter them again.\n";
            msg += lowerLine;
      }            
      alert(msg);
      return false;
}      

function sfCheckPlus(frm) {
      
      if (window.document.form1.ShipFirstName.value != "" || window.document.form1.ShipMiddleInitial.value != "" || window.document.form1.ShipLastName.value != "" || window.document.form1.ShipCompany.value != "" || window.document.form1.ShipAddress1.value != "" || window.document.form1.ShipAddress2.value != "" || window.document.form1.ShipCity.value != "" || window.document.form1.ShipState.value != "" || window.document.form1.ShipZip.value != "" || window.document.form1.ShipCountry.value != "" || window.document.form1.ShipPhone.value != "" || window.document.form1.ShipEmail.value != "" || window.document.form1.ShipFax.value != "")                   
      {
      if (window.document.form1.ShipFirstName.value == "" || window.document.form1.ShipLastName.value == "" || window.document.form1.ShipAddress1.value == "" || window.document.form1.ShipCity.value == "" || window.document.form1.ShipState.value == "" || window.document.form1.ShipZip.value == "" || window.document.form1.ShipCountry.value == "" || window.document.form1.ShipPhone.value == "" || window.document.form1.ShipEmail.value == "")                   
      {
      window.alert("Please either fill in all shipping info or no shipping info.")
      return false
      }
      else
      {return sfCheck(frm)}
      }              

}
function POCheck(poname,poNum)
{
  if(poname == "" || poNum == "")
   {
    alert("Please Enter the required purchase order information");
     
    return false;
   }
   else
    {
     return true;
    }
}
ASKER CERTIFIED SOLUTION
Avatar of jaysolomon
jaysolomon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jaysolomon
jaysolomon

i left a } out
 if(e.name == "prodLink1" || e.name == "prodLink2" || e.name == "prodLink3" || e.name == "prodLink4"){
            if(e.value == ""){ return true;}}
Avatar of richardwakefield

ASKER

You da man! :)
glad i could help and thanks for the A
jAy