Link to home
Start Free TrialLog in
Avatar of Bill Henderson
Bill HendersonFlag for United States of America

asked on

ASPVB newb struggling with DMXZone image upload/resize

Hi,

I have an aspVB page built in Dreamweaver using DMXZone's ASP Upload 3 and Smart Image Processor 2 on multiple image file fields - the form is an update record form that correctly captures and updates every value except the file fields.

If a user uploads a new picture every time, the system works perfectly. However, if a user decides not to upload a new picture (say they just want to change the name or price) the existing image record in the database gets overwritten with a blank value.

DXMZone's own content indicates that to solve this, all you need to do is bind the image field record to the image upload field in the form and then if no new image is selected, it will capture the old image db value and proceed.

But this doesn't work.

Can anyone guess as to why this form is behaving as described? Sorry the code is so long, but it's a complex form. I believe the critical code in question is on the image field itself and a hidden file field as well:

<label>
                <input name="image1" type="file" id="image1" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" value="<%=(Recordset4.Fields.Item("Image1").Value)%>" />
                </label>

and here is the hidden field:

<input type="hidden" name="upload_org_image1" value="<%=(Recordset4.Fields.Item("Image1").Value)%>" />

But the full code may shed some light on what is happening if you are an ASP or VB expert (or DMX Zone expert).

Here is the full code:

<%@LANGUAGE="VBSCRIPT"%>

<!--#include file="Connections/shepherds.asp" -->
<!--#include file="ScriptLibrary/incPU3Class.asp" -->
<!--#include file="ScriptLibrary/incPU3Utils.asp" -->
<%
'*** Pure ASP File Upload 3.0.9
' Process form shepherd
Dim pau, DMX_uploadAction, UploadRequest, UploadQueryString, pau_thePath, pau_nameConflict, pau_saveWidth, pau_saveHeight
Set pau = new PureUpload
pau.ScriptLibrary = "ScriptLibrary"
pau.MaxSize = 20000
pau.ConflictHandling = "over"
pau.StoreType = "file"
pau.ProgressTemplate = "vista_look.htm"
pau.ProgressWidth = 300
pau.ProgressHeight = 100
pau.UploadFolder = """Uploads"""
pau.AllowedExtensions = "GIF,JPG,JPEG,BMP,PNG" ' "images"
pau.MaxFileSize = 10000
pau.ProcessUpload
pau.SaveAll
%>
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (UploadQueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(UploadQueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
  If condition = "" Then
    MM_IIf = ifFalse
  Else
    MM_IIf = ifTrue
  End If
End Function
%>
<%
If (CStr(UploadFormRequest("MM_update")) = "shepherd") Then
  If (Not MM_abortEdit) Then
    ' execute the update
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_shepherds_STRING
    MM_editCmd.CommandText = "UPDATE Product SET DescriptionType = ?, ProdCatID = ?, ProdName = ?, MainParagraph = ?, [1line_desc] = ?, desc3 = ?, desc2 = ?, firstbulletlistline1 = ?, firstbulletlist = ?, firstbulletlistline3 = ?, firstbulletlistline2 = ?, firstbulletlistline5 = ?, firstbulletlistline4 = ?, secondbulletlistline1 = ?, secondbulletlist = ?, secondbulletlistline3 = ?, secondbulletlistline2 = ?, secondbulletlistline5 = ?, secondbulletlistline4 = ?, SizesYesNo = ?, PricedFrom = ?, SpecialShippingAmount = ?, SpecialShippingYesNo = ?, FeaturedYesNo = ?, CarePage12 = ?, OptionalPageLink = ?, PackagingCharge = ?, OptionalPageLinkText = ?, OnSaleYesNo = ?, RecommendedAdd2 = ?, RecommendedAdd1 = ?, ShipsBy = ?, Image1 = ?, Image4 = ?, Image2 = ?, Image5 = ?, Image3 = ? WHERE ID = ?"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, UploadFormRequest("DescriptionType")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 50, UploadFormRequest("ProdCatID")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 203, 1, 1073741823, UploadFormRequest("ProdName")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 203, 1, 1073741823, UploadFormRequest("MainParagraph")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 203, 1, 1073741823, UploadFormRequest("1line_desc")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 203, 1, 1073741823, UploadFormRequest("desc3")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 203, 1, 1073741823, UploadFormRequest("desc2")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 203, 1, 1073741823, UploadFormRequest("firstbulletlistline1")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 203, 1, 1073741823, UploadFormRequest("firstbulletlist")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param10", 203, 1, 1073741823, UploadFormRequest("firstbulletlistline3")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param11", 203, 1, 1073741823, UploadFormRequest("firstbulletlistline2")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param12", 203, 1, 1073741823, UploadFormRequest("firstbulletlistline5")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param13", 203, 1, 1073741823, UploadFormRequest("firstbulletlistline4")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param14", 203, 1, 1073741823, UploadFormRequest("secondbulletlistline1")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param15", 203, 1, 1073741823, UploadFormRequest("secondbulletlist")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param16", 203, 1, 1073741823, UploadFormRequest("secondbulletlistline3")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param17", 203, 1, 1073741823, UploadFormRequest("secondbulletlistline2")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param18", 203, 1, 1073741823, UploadFormRequest("secondbulletlistline5")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param19", 203, 1, 1073741823, UploadFormRequest("secondbulletlistline4")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param20", 202, 1, 255, UploadFormRequest("SizesYesNo")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param21", 202, 1, 255, UploadFormRequest("PricedFrom")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param22", 202, 1, 255, UploadFormRequest("SpecialShippingAmount")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param23", 202, 1, 255, UploadFormRequest("SpecialShippingYesNo")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param24", 202, 1, 50, UploadFormRequest("FeaturedYesNo")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param25", 202, 1, 255, UploadFormRequest("CarePage12")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param26", 203, 1, 1073741823, UploadFormRequest("OptionalPageLink")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param27", 202, 1, 255, UploadFormRequest("PackagingCharge")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param28", 203, 1, 1073741823, UploadFormRequest("OptionalPageLinkText")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param29", 202, 1, 255, UploadFormRequest("OnSaleYesNo")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param30", 202, 1, 50, UploadFormRequest("RecommendedAdd2")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param31", 202, 1, 50, UploadFormRequest("RecommendedAdd1")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param32", 203, 1, 1073741823, UploadFormRequest("ShipsBy")) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param33", 203, 1, 1073741823, MM_IIF(UploadFormRequest("image1"), UploadFormRequest("image1"), UploadFormRequest("upload_org_image1"))) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param34", 203, 1, 1073741823, MM_IIF(UploadFormRequest("image4"), UploadFormRequest("image4"), UploadFormRequest("upload_org_image4"))) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param35", 203, 1, 1073741823, MM_IIF(UploadFormRequest("image2"), UploadFormRequest("image2"), UploadFormRequest("upload_org_image2"))) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param36", 203, 1, 1073741823, MM_IIF(UploadFormRequest("image5"), UploadFormRequest("image5"), UploadFormRequest("upload_org_image5"))) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param37", 203, 1, 1073741823, MM_IIF(UploadFormRequest("image3"), UploadFormRequest("image3"), UploadFormRequest("upload_org_image3"))) ' adLongVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param38", 5, 1, -1, MM_IIF(UploadFormRequest("MM_recordId"), UploadFormRequest("MM_recordId"), null)) ' adDouble
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "add_sizes.asp"
    If (UploadQueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & UploadQueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & UploadQueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_shepherds_STRING
Recordset1_cmd.CommandText = "SELECT * FROM ProdCategory ORDER BY CatName ASC"
Recordset1_cmd.Prepared = true

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
Dim Recordset2
Dim Recordset2_cmd
Dim Recordset2_numRows

Set Recordset2_cmd = Server.CreateObject ("ADODB.Command")
Recordset2_cmd.ActiveConnection = MM_shepherds_STRING
Recordset2_cmd.CommandText = "SELECT * FROM Product ORDER BY ProdName ASC"
Recordset2_cmd.Prepared = true

Set Recordset2 = Recordset2_cmd.Execute
Recordset2_numRows = 0
%>
<%
Dim Recordset3
Dim Recordset3_cmd
Dim Recordset3_numRows

Set Recordset3_cmd = Server.CreateObject ("ADODB.Command")
Recordset3_cmd.ActiveConnection = MM_shepherds_STRING
Recordset3_cmd.CommandText = "SELECT * FROM Product ORDER BY ProdName ASC"
Recordset3_cmd.Prepared = true

Set Recordset3 = Recordset3_cmd.Execute
Recordset3_numRows = 0
%>
<%
Dim Recordset4__MMColParam
Recordset4__MMColParam = "1"
If (Request.QueryString("ID") <> "") Then
  Recordset4__MMColParam = Request.QueryString("ID")
End If
%>
<%
Dim Recordset4
Dim Recordset4_cmd
Dim Recordset4_numRows

Set Recordset4_cmd = Server.CreateObject ("ADODB.Command")
Recordset4_cmd.ActiveConnection = MM_shepherds_STRING
Recordset4_cmd.CommandText = "SELECT * FROM Product WHERE ID = ?"
Recordset4_cmd.Prepared = true
Recordset4_cmd.Parameters.Append Recordset4_cmd.CreateParameter("param1", 5, 1, -1, Recordset4__MMColParam) ' adDouble

Set Recordset4 = Recordset4_cmd.Execute
Recordset4_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style4 {color: #FF0000}
-->
</style>
<script type="text/javascript"><%=pau.generateScriptCode()%></script>
<script src="ScriptLibrary/incPU3.js" type="text/javascript"></script>
<head>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


<title>Shepherds Dream</title>


<link href="styles/shepherds_dream_notfinal.css" rel="stylesheet" type="text/css">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/javascript" src="csshorizontalmenu.js"></script>
<script type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//-->
</script>
</head>
<body onLoad="MM_preloadImages('images/2button1_over.gif','images/2button2_over.gif','images/2button3_over.gif','images/2button4_over.gif')">
<div id="banner_container">
 

        <div class="horizontalcssmenu" >
          <ul id="cssmenu1" name="cssmenu1">
            <li><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image4','','images/2button1_over.gif',1)"><img src="images/2button1.gif" name="Image4"  id="Image4" /><span class="arrowdiv"></span></a>
                <ul style="top: 124px; visibility: hidden;">
                  <li><a href="#">The People</a></li>
                  <li><a href="#">Philosophy and Mission</a></li>
                  <li><a href="#">Contact Us</a></li>
                           <li><a href="#">In Canada?</a></li>
                </ul>
            </li>
<li><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image5','','images/2button2_over.gif',1)"><img src="images/2button2.gif" name="Image5"  id="Image5" /><span class="arrowdiv"></span></a>
                <ul style="top: 124px; visibility: hidden;">
                  <li><a href="#">Search All Products</a></li>
                  <li><a href="#">Design Principles</a></li>
                  <li><a href="#">Product Care</a></li>
                </ul>
            </li>
<li><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image6','','images/2button3_over.gif',1)"><img src="images/2button3.gif" name="Image6"  id="Image6" /><span class="arrowdiv"></span></a>
                <ul style="top: 124px;left:0; visibility: hidden;">
                  <li><a href="#">Benefits of Wool</a></li>
                  <li><a href="#">Healthy Bed Checklist</a></li>
                  <li><a href="#">Chemical Sensitivity</a></li>
                          <li><a href="#">Other Resources</a></li>
                </ul>
            </li>
<li><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image7','','images/2button4_over.gif',1)"><img src="images/2button4.gif" name="Image7"  id="Image7" /><span class="arrowdiv"></span></a>
                <ul style="top: 124px; visibility: hidden;">
                  <li><a href="#">Wooldbed Materials</a></li>
                  <li><a href="#">Wool Industry</a></li>
                </ul>
            </li>
</ul>
  </div>
</div>

<div id="lower_container">
  <div id="leftnav_container">
    <h3>Online Store</h3>
    <strong><br />
    Product Search</strong>




    <div class="navsite" >
     
        <ul>
          <li> <a href="category_summary.asp?CatID=21">Wool Pillows </a></li>
        </ul>
    </div>
    <div class="navsite" >
      <ul>
        <li> <a href="category_summary.asp?CatID=22">Mattresses </a></li>
      </ul>
    </div>
      <div class="navsite" >
     
        <ul>
          <li> <a href="category_summary.asp?CatID=23">Mattress Toppers </a></li>
        </ul>
    </div>
    <div class="navsite" >
      <ul>
        <li> <a href="category_summary.asp?CatID=24">Comforters </a></li>
      </ul>
    </div>
      <div class="navsite" >
     
        <ul>
          <li> <a href="category_summary.asp?CatID=25">Wood Frames </a></li>
        </ul>
    </div>
    <div class="navsite" >
      <ul>
        <li> <a href="category_summary.asp?CatID=26">Raw Materials  </a></li>
      </ul>
    </div>
      <div class="navsite" >
     
        <ul>
          <li> <a href="category_summary.asp?CatID=27">Organic Cotton Sheets  </a></li>
        </ul>
    </div>
   
   
   
    <div class="inner_box"><a href="#">Request a Sample Bedding Kit </a></div>
      <div class="inner_box"><a href="#">Canada Customers <br />
    Click Here </a></div>
      <div class="inner_box"><a href="#">Sensitivities &amp; Wool Allergies??? </a></div>
  <img src="images/color_logo.jpg" alt="Logo" width="169" height="170" /></div>
  <div id="content_container">
    <div class="form_objects"><a href="index.asp">Home </a>| <a href="#">Sign-In </a>| <a href="#">Cart (0)</a> | <a href="#">Call Us</a> </div>
   
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><form ACTION="<%=MM_editAction%>" METHOD="post" enctype="multipart/form-data" name="shepherd" id="form1" onSubmit="<%=pau.submitCode()%>;return document.MM_returnValue">
          <table width="70%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><div align="center">Simple</div></td>
              <td><div align="center">Medium</div></td>
              <td><div align="center">Complex</div></td>
            </tr>
            <tr>
              <td><input <%If (CStr((Recordset4.Fields.Item("DescriptionType").Value)) = CStr("1")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="DescriptionType" type="radio" id="radio" value="1" onclick=  
      "document.getElementById('div5').style.display = 'none';
      document.getElementById('div6').style.display = 'none';
      document.getElementById('div13').style.display = 'none';
      document.getElementById('div14').style.display = 'none';
      document.getElementById('div15').style.display = 'none';
      document.getElementById('div16').style.display = 'none';
      document.getElementById('div17').style.display = 'none';
      document.getElementById('div18').style.display = 'none';
    document.getElementById('div').style.display = 'block';
      document.getElementById('div2').style.display = 'block';
      document.getElementById('div3').style.display = 'block';
      document.getElementById('div4').style.display = 'block';
      document.getElementById('div7').style.display = 'block';
      document.getElementById('div8').style.display = 'block';
      document.getElementById('div9').style.display = 'block';
      document.getElementById('div10').style.display = 'block';
      document.getElementById('div11').style.display = 'block';
      document.getElementById('div12').style.display = 'block';
      document.getElementById('div28').style.display = 'block';
      document.getElementById('div24').style.display = 'block';
      document.getElementById('div52').style.display = 'block';
      document.getElementById('div52a').style.display = 'block';
      document.getElementById('div54').style.display = 'block';
      document.getElementById('div55').style.display = 'block';
      document.getElementById('div56').style.display = 'block';
            document.getElementById('div57').style.display = 'block';
      document.getElementById('div58').style.display = 'block';
      document.getElementById('div59').style.display = 'block';
      document.getElementById('div64').style.display = 'block';
      document.getElementById('div65').style.display = 'block';
      document.getElementById('div66').style.display = 'block';
      document.getElementById('div67').style.display = 'block';
      document.getElementById('div68').style.display = 'block';
      document.getElementById('div69').style.display = 'block';
      document.getElementById('div99').style.display = 'block';"/></td>
              <td><input <%If (CStr((Recordset4.Fields.Item("DescriptionType").Value)) = CStr("2")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="DescriptionType" type="radio" id="DescriptionType" value="2"
      onclick=  
      "document.getElementById('div5').style.display = 'block';
      document.getElementById('div6').style.display = 'none';
      document.getElementById('div13').style.display = 'block';
      document.getElementById('div14').style.display = 'block';
      document.getElementById('div15').style.display = 'block';
      document.getElementById('div16').style.display = 'block';
      document.getElementById('div17').style.display = 'block';
      
      document.getElementById('div24').style.display = 'block';
      document.getElementById('div28').style.display = 'block';
      document.getElementById('div18').style.display = 'block';
    document.getElementById('div').style.display = 'block';
      document.getElementById('div2').style.display = 'block';
      document.getElementById('div3').style.display = 'block';
      document.getElementById('div4').style.display = 'block';
      document.getElementById('div7').style.display = 'block';
      document.getElementById('div8').style.display = 'block';
      document.getElementById('div9').style.display = 'block';
      document.getElementById('div10').style.display = 'block';
      document.getElementById('div11').style.display = 'block';
      document.getElementById('div12').style.display = 'block';
      document.getElementById('div52').style.display = 'block';
      document.getElementById('div52a').style.display = 'block';
      document.getElementById('div54').style.display = 'block';
      document.getElementById('div55').style.display = 'block';
      document.getElementById('div56').style.display = 'block';
      document.getElementById('div57').style.display = 'block';
      document.getElementById('div58').style.display = 'block';
      document.getElementById('div59').style.display = 'block';
      document.getElementById('div64').style.display = 'block';
      document.getElementById('div65').style.display = 'block';
      document.getElementById('div66').style.display = 'block';
      document.getElementById('div67').style.display = 'block';
      document.getElementById('div68').style.display = 'block';
      document.getElementById('div69').style.display = 'block';
      document.getElementById('div99').style.display = 'block';"/></td>
              <td><input <%If (CStr((Recordset4.Fields.Item("DescriptionType").Value)) = CStr("3")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="DescriptionType" type="radio" id="DescriptionType" value="3" onclick=  
      "document.getElementById('div5').style.display = 'block';
      document.getElementById('div6').style.display = 'block';
      document.getElementById('div13').style.display = 'block';
      document.getElementById('div14').style.display = 'block';
      document.getElementById('div15').style.display = 'block';
      document.getElementById('div16').style.display = 'block';
      document.getElementById('div17').style.display = 'block';
      document.getElementById('div18').style.display = 'block';
    document.getElementById('div').style.display = 'block';
      document.getElementById('div2').style.display = 'block';
      document.getElementById('div3').style.display = 'block';
      document.getElementById('div4').style.display = 'block';
      document.getElementById('div7').style.display = 'block';
      document.getElementById('div8').style.display = 'block';
      document.getElementById('div9').style.display = 'block';
      document.getElementById('div10').style.display = 'block';
      document.getElementById('div11').style.display = 'block';
      document.getElementById('div12').style.display = 'block';
      document.getElementById('div28').style.display = 'block';
      document.getElementById('div52').style.display = 'block';
      document.getElementById('div52a').style.display = 'block';
      document.getElementById('div54').style.display = 'block';
      document.getElementById('div55').style.display = 'block';
      document.getElementById('div56').style.display = 'block';
      document.getElementById('div99').style.display = 'block';
      document.getElementById('div24').style.display = 'block';
      document.getElementById('div57').style.display = 'block';
      document.getElementById('div58').style.display = 'block';
      document.getElementById('div59').style.display = 'block';
      document.getElementById('div64').style.display = 'block';
      document.getElementById('div65').style.display = 'block';
      document.getElementById('div66').style.display = 'block';
      document.getElementById('div67').style.display = 'block';
      document.getElementById('div68').style.display = 'block';
      document.getElementById('div69').style.display = 'block';"/></td>
            </tr>
          </table>
          <div class="form_object4" id="div82">
            <div class="form_object1" id="div">Product Category
              <label>
                <select name="ProdCatID" id="ProdCatID">
                  <option value=" " <%If (Not isNull((Recordset4.Fields.Item("ProdCatID").Value))) Then If (" " = CStr((Recordset4.Fields.Item("ProdCatID").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>></option>
                  <%
While (NOT Recordset1.EOF)
%>
                  <option value="<%=(Recordset1.Fields.Item("CatID").Value)%>" <%If (Not isNull((Recordset4.Fields.Item("ProdCatID").Value))) Then If (CStr(Recordset1.Fields.Item("CatID").Value) = CStr((Recordset4.Fields.Item("ProdCatID").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(Recordset1.Fields.Item("CatName").Value)%></option>
                  <%
  Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
  Recordset1.MoveFirst
Else
  Recordset1.Requery
End If
%>
                </select>
                </label>
            </div>
            <div class="form_object1" id="div2">Product Name
              <label>
                <input name="ProdName" type="text" id="ProdName" value="<%=(Recordset4.Fields.Item("ProdName").Value)%>" />
                </label>
            </div>
            <div class="form_object1" id="div4">1st Paragraph
              <label>
                <textarea name="MainParagraph" id="MainParagraph" >
                <%=(Recordset4.Fields.Item("MainParagraph").Value)%></textarea>
                </label>
            </div>
            <div class="form_object1" id="div3">1 Line Description
              <textarea name="1line_desc" id="1line_desc"><%=(Recordset4.Fields.Item("1line_desc").Value)%></textarea>
            </div>
            <div class="form_object3" id="div6">3rd Paragraph
              <textarea name="desc3" id="desc3"> <%=(Recordset4.Fields.Item("desc3").Value)%></textarea>
            </div>
            <div class="form_object2" id="div5">2nd Paragraph
              <textarea name="desc2" id="desc2"><%=(Recordset4.Fields.Item("desc2").Value)%></textarea>
            </div>
          </div>
          <div class="form_object4" id="div83">
            <div class="form_object1" id="div8">Bullet#1
              <input name="firstbulletlistline1" type="text" id="firstbulletlistline1" value="<%=(Recordset4.Fields.Item("firstbulletlistline1").Value)%>" />
            </div>
            <div class="form_object1" id="div7">Bullet List Title (optional)
              <input name="firstbulletlist" type="text" id="firstbulletlist" value="<%=(Recordset4.Fields.Item("firstbulletlist").Value)%>" />
            </div>
            <div class="form_object1" id="div10">Bullet#3
              <input name="firstbulletlistline3" type="text" id="firstbulletlistline3" value="<%=(Recordset4.Fields.Item("firstbulletlistline3").Value)%>" />
            </div>
            <div class="form_object1" id="div9">Bullet#2
              <input name="firstbulletlistline2" type="text" id="firstbulletlistline2" value="<%=(Recordset4.Fields.Item("firstbulletlistline2").Value)%>" />
            </div>
            <div class="form_object1" id="div12">Bullet#5 (optional)
              <input name="firstbulletlistline5" type="text" id="firstbulletlistline5" value="<%=(Recordset4.Fields.Item("firstbulletlistline5").Value)%>" />
            </div>
            <div class="form_object1" id="div11">Bullet#4 (optional)
              <input name="firstbulletlistline4" type="text" id="firstbulletlistline4" value="<%=(Recordset4.Fields.Item("firstbulletlistline4").Value)%>" />
            </div>
          </div>
          <div class="form_object4" id="div84">
            <div class="form_object2" id="div14">Bullet#1 (optional)
              <input name="secondbulletlistline1" type="text" id="secondbulletlistline1" value="<%=(Recordset4.Fields.Item("secondbulletlistline1").Value)%>" />
            </div>
            <div class="form_object2" id="div13">Bullet List#2 Title (optional)
              <input name="secondbulletlist" type="text" id="secondbulletlist" value="<%=(Recordset4.Fields.Item("secondbulletlist").Value)%>" />
            </div>
            <div class="form_object2" id="div16">Bullet#3 (optional)
              <input name="secondbulletlistline3" type="text" id="secondbulletlistline3" value="<%=(Recordset4.Fields.Item("secondbulletlistline3").Value)%>" />
            </div>
            <div class="form_object2" id="div15">Bullet#2 (optional)
              <input name="secondbulletlistline2" type="text" id="secondbulletlistline2" value="<%=(Recordset4.Fields.Item("secondbulletlistline2").Value)%>" />
            </div>
            <div class="form_object2" id="div18">Bullet#5 (optional)
              <input name="secondbulletlistline5" type="text" id="secondbulletlistline5" value="<%=(Recordset4.Fields.Item("secondbulletlistline5").Value)%>" />
            </div>
            <div class="form_object2" id="div17">Bullet#4 (optional)
              <input name="secondbulletlistline4" type="text" id="secondbulletlistline4" value="<%=(Recordset4.Fields.Item("secondbulletlistline4").Value)%>" />
            </div>
          </div>
          <div class="form_object4" id="div85">
            <div class="form_object2" id="div24">Sizes?
              <table width="70%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><div align="center">Yes</div></td>
                    <td><div align="center">No</div></td>
                  </tr>
                  <tr>
                    <td><input <%If (CStr((Recordset4.Fields.Item("SizesYesNo").Value)) = CStr("Yes")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="SizesYesNo" type="radio" id="SizesYesNo" value="Yes" /></td>
                    <td><input <%If (CStr((Recordset4.Fields.Item("SizesYesNo").Value)) = CStr("No")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="SizesYesNo" type="radio" id="SizesYesNo" value="No" /></td>
                  </tr>
                </table>
            </div>
            <div class="form_object2" id="div99">Priced From: $
              <label></label>
                <input name="PricedFrom" type="text" value="<%=(Recordset4.Fields.Item("PricedFrom").Value)%>" />
            </div>
          </div>
          <div class="form_object4" id="div86">
            <div class="form_object1" id="div53">Special Shipping Price
              <input name="SpecialShippingAmount" type="text" id="SpecialShippingAmount" value="<%=(Recordset4.Fields.Item("SpecialShippingAmount").Value)%>" />
            </div>
            <div class="form_object1" id="div52a">Special Shipping?
              <table width="70%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><div align="center">Yes</div></td>
                    <td><div align="center">No</div></td>
                  </tr>
                  <tr>
                    <td><input <%If (CStr((Recordset4.Fields.Item("SpecialShippingYesNo").Value)) = CStr("Yes")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="SpecialShippingYesNo" type="radio" id="SpecialShippingYesNo" value="Yes" onclick=  
      "document.getElementById('div53').style.display = 'block';" /></td>
                    <td><input <%If (CStr((Recordset4.Fields.Item("SpecialShippingYesNo").Value)) = CStr("No")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="SpecialShippingYesNo" type="radio" id="SpecialShippingYesNo"
       value="No" onclick=  
      "document.getElementById('div53').style.display = 'none'; "/></td>
                  </tr>
                </table>
            </div>
          </div>
          <div class="form_object4" id="div90">
            <div class="form_object1" id="div52">Featured?
              <table width="70%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><div align="center">Yes</div></td>
                    <td><div align="center">No</div></td>
                  </tr>
                  <tr>
                    <td><input <%If (CStr((Recordset4.Fields.Item("FeaturedYesNo").Value)) = CStr("Yes")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="FeaturedYesNo" type="radio" id="FeaturedYesNo" value="Yes" /></td>
                    <td><input <%If (CStr((Recordset4.Fields.Item("FeaturedYesNo").Value)) = CStr("No")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="FeaturedYesNo" type="radio" id="FeaturedYesNo"
       value="No" checked="checked"/></td>
                  </tr>
                </table>
            </div>
            <div class="form_object1" id="div54">Care Page
              <table width="70%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><div align="center">Page1</div></td>
                    <td><div align="center">Page2</div></td>
                  </tr>
                  <tr>
                    <td><input <%If (CStr((Recordset4.Fields.Item("CarePage12").Value)) = CStr("Yes")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="CarePage12" type="radio" id="CarePage12" value="Yes" /></td>
                    <td><input <%If (CStr((Recordset4.Fields.Item("CarePage12").Value)) = CStr("No")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="CarePage12" type="radio" id="CarePage12"
       value="No"/></td>
                  </tr>
                </table>
            </div>
          </div>
          <div class="form_object4" id="div80">
            <div class="form_object1" id="div57">Optional Link
              <input name="OptionalPageLink" type="text" id="OptionalPageLink" value="<%=(Recordset4.Fields.Item("OptionalPageLink").Value)%>" />
            </div>
            <div class="form_object1" id="div58">Packaging Charge?
              <input name="PackagingCharge" type="text" id="PackagingCharge" value="<%=(Recordset4.Fields.Item("PackagingCharge").Value)%>" />
            </div>
            <div class="form_object1" id="div59">Text of Optional Link
              <input name="OptionalPageLinkText" type="text" id="OptionalPageLinkText" value="<%=(Recordset4.Fields.Item("OptionalPageLinkText").Value)%>" />
            </div>
            <div class="form_object1" id="div56">On Sale?
              <table width="70%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><div align="center">Yes</div></td>
                    <td><div align="center">No</div></td>
                  </tr>
                  <tr>
                    <td><input <%If (CStr((Recordset4.Fields.Item("OnSaleYesNo").Value)) = CStr("Yes")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="OnSaleYesNo" type="radio" id="OnSaleYesNo" value="Yes" /></td>
                    <td><input <%If (CStr((Recordset4.Fields.Item("OnSaleYesNo").Value)) = CStr("No")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="OnSaleYesNo" type="radio" id="OnSaleYesNo" value="No" /></td>
                  </tr>
                </table>
            </div>
            <div class="form_object1" id="div28">Recommended Add2
              <label>
                <select name="RecommendedAdd2" id="RecommendedAdd2">
                  <option value=" " <%If (Not isNull((Recordset4.Fields.Item("RecommendedAdd2").Value))) Then If (" " = CStr((Recordset4.Fields.Item("RecommendedAdd2").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>></option>
                  <%
While (NOT Recordset3.EOF)
%>
                  <option value="<%=(Recordset3.Fields.Item("ID").Value)%>" <%If (Not isNull((Recordset4.Fields.Item("RecommendedAdd2").Value))) Then If (CStr(Recordset3.Fields.Item("ID").Value) = CStr((Recordset4.Fields.Item("RecommendedAdd2").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(Recordset3.Fields.Item("ProdName").Value)%></option>
                  <%
  Recordset3.MoveNext()
Wend
If (Recordset3.CursorType > 0) Then
  Recordset3.MoveFirst
Else
  Recordset3.Requery
End If
%>
                </select>
                </label>
            </div>
            <div class="form_object1" id="div55">Recommended Add1
              <select name="RecommendedAdd1" id="RecommendedAdd1">
                  <option value=" " <%If (Not isNull((Recordset4.Fields.Item("RecommendedAdd1").Value))) Then If (" " = CStr((Recordset4.Fields.Item("RecommendedAdd1").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>></option>
                  <%
While (NOT Recordset2.EOF)
%>
                  <option value="<%=(Recordset2.Fields.Item("ID").Value)%>" <%If (Not isNull((Recordset4.Fields.Item("RecommendedAdd1").Value))) Then If (CStr(Recordset2.Fields.Item("ID").Value) = CStr((Recordset4.Fields.Item("RecommendedAdd1").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(Recordset2.Fields.Item("ProdName").Value)%></option>
                  <%
  Recordset2.MoveNext()
Wend
If (Recordset2.CursorType > 0) Then
  Recordset2.MoveFirst
Else
  Recordset2.Requery
End If
%>
                </select>
            </div>
          </div>
          <div class="form_object4" id="div81">
            <div class="form_object1" id="div69">Shipping Details
              <label></label>
                <label>
                <input name="ShipsBy" type="text" id="ShipsBy" value="<%=(Recordset4.Fields.Item("ShipsBy").Value)%>" />
                </label>
            </div>
            <div class="form_object1" id="div64">Image 1 <span class="style4">
              <label> </label>
              </span>
                <label>
                <input name="image1" type="file" id="image1" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" value="<%=(Recordset4.Fields.Item("Image1").Value)%>" />
                </label>
            </div>
            <div class="form_object1" id="div66">Image 4
              <input name="image4" type="file" id="image4" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" value="<%=(Recordset4.Fields.Item("Image4").Value)%>" />
            </div>
            <div class="form_object1" id="div65">Image 2
              <input name="image2" type="file" id="image2" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" value="<%=(Recordset4.Fields.Item("Image2").Value)%>" />
            </div>
            <div class="form_object1" id="div68">Image 5
              <input name="image5" type="file" id="image5" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" value="<%=(Recordset4.Fields.Item("Image5").Value)%>" />
            </div>
            <div class="form_object1" id="div67">Image 3
              <input name="image3" type="file" id="image3" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" value="<%=(Recordset4.Fields.Item("Image3").Value)%>" />
            </div>
          </div>
          <label>
          <input type="submit" name="Submit" value="Submit" />
          </label>
          <input type="hidden" name="MM_update" value="shepherd" />
          <input type="hidden" name="MM_recordId" value="<%= Recordset4.Fields.Item("ID").Value %>" />
          <input type="hidden" name="upload_org_image1" value="<%=(Recordset4.Fields.Item("Image1").Value)%>" />
          <input type="hidden" name="upload_org_image4" value="<%=(Recordset4.Fields.Item("Image4").Value)%>" />
          <input type="hidden" name="upload_org_image2" value="<%=(Recordset4.Fields.Item("Image2").Value)%>" />
          <input type="hidden" name="upload_org_image5" value="<%=(Recordset4.Fields.Item("Image5").Value)%>" />
          <input type="hidden" name="upload_org_image3" value="<%=(Recordset4.Fields.Item("Image3").Value)%>" />
        </form>        </td>
      </tr>
    </table>
      <div align="left"><a href="#">Shop Online</a> | <a href="#">Our Story</a> | <a href="#">Contact Us</a> | <a href="#">Our Products</a> | <a href="#">FAQ</a> | <a href="#">Testimonials </a></div>
  </div>
<a href="signed_in.asp"><img src="images/image_spacer.jpg" alt="1" /></a></div>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>
<%
Recordset3.Close()
Set Recordset3 = Nothing
%>
<%
Recordset4.Close()
Set Recordset4 = Nothing
%>
SOLUTION
Avatar of Rouchie
Rouchie
Flag of United Kingdom of Great Britain and Northern Ireland image

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 Bill Henderson

ASKER

Hi - thanks. Didn't catch the head tags got screwed up. That's fixed.

So the database fields being overwritten are Image1, Image2, etc - I think this block of code is supposed to be helping prevent that from happening:

<input type="hidden" name="upload_org_image1" value="<%=(Recordset4.Fields.Item("Image1").Value)%>" />
          <input type="hidden" name="upload_org_image4" value="<%=(Recordset4.Fields.Item("Image4").Value)%>" />
          <input type="hidden" name="upload_org_image2" value="<%=(Recordset4.Fields.Item("Image2").Value)%>" />
          <input type="hidden" name="upload_org_image5" value="<%=(Recordset4.Fields.Item("Image5").Value)%>" />
          <input type="hidden" name="upload_org_image3" value="<%=(Recordset4.Fields.Item("Image3").Value)%>" />

Bill
ASKER CERTIFIED SOLUTION
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
Thanks - didn't know you could do that =)

Here is the hidden value:

<label>
                <input name="image1" type="file" id="image1" onchange="validateFile(this, 'GIF,JPG,JPEG,BMP,PNG', false);return document.MM_returnValue" value="19_latexpadded.jpg" />
                </label>
SOLUTION
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
ack

Here it is:

    <input type="hidden" name="upload_org_image1" value="" />
          <input type="hidden" name="upload_org_image4" value="" />
          <input type="hidden" name="upload_org_image2" value="" />
          <input type="hidden" name="upload_org_image5" value="" />
          <input type="hidden" name="upload_org_image3" value="" />

Now...I once tried, on another page to use the same value from the same db field twice in a page and it kept only giving me the first instance of the value. I had to create a separate object and define it as that field value in order to reuse it. Am I on the right track here?

Trying to find the syntax the other time I did this - searching files...

Bill
So for some reason when the form loads, the hidden fields are not being populated with the original image names.  Therefore these blanks are being saved as NULL values.

Can you also tell me the VALUE when the page is run of this form field (approx line 662):

<input name="image1" type="file" id="image1" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" value="<%=(Recordset4.Fields.Item("Image1").Value)%>" />
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This will check if RecordSet4 is working properly, as it seems to be the same recordset that populates the entire form.
Hi

Recordset 4 was working properly - the issue was reuse of the same db value in the same recordset, which does not appear to work.

Instead I defined 5 new objects (variables?):

<%
pic1 = (Recordset4.Fields.Item("Image1").Value)
pic2 = (Recordset4.Fields.Item("Image2").Value)
pic3 = (Recordset4.Fields.Item("Image3").Value)
pic4 = (Recordset4.Fields.Item("Image4").Value)
pic5 = (Recordset4.Fields.Item("Image5").Value)
%>

Then in the multiple locations I needed to pull up the same value from the same db field, I don't have to do another recordset - instead, I just use <%=pic1%>

This did it - but it never occurred to me to view source for dynamic data (maybe this is really basic lol) - that's a great tip either way!

Thanks

Bill
Bill.  The solution you've chosen is about the only way to overcome your issue.  It's a pity that these basic limitations in ASP aren't communicated enough!

Thanks for the points anyway.
Nah - I appreciated the direction you sent me in - and the real culprit here is probably DMXZone, although they imply that this is something unique with my situation.

One final question I would have:

I'm trying to break away from plug-ins and build/steal the code I need manually, which will hopefully help me understand all of this better than clicking through a few GUIs does. Do you have any recommendation for resources to manually produce file uploads, including image resizing, watermarks, etc?

DMXZone's plug-in is using the AspJpeg server component, but I believe we have .NET capabilities with our new dedicated server as well.

Any advice there would be much appreciated.

Cheers in any case!

Bill
>> Do you have any recommendation for resources to manually produce file uploads, including image resizing, watermarks, etc?

Yes, but it involves taking a step backwards for you.  ASP is now well out of date with regards to the functionality modern web apps should provide.  For this reason, I always recommend a move to ASP.NET

It is a big step, but the power that you get from .NET is unbelievable.  The .NET framework is basically a collection of thousands of pre-written code chunks that you can use, for free, in your application.  There is a built-in file uploader, and also an image processor that will do exactly what you need.

Classic ASP can't do this sort of thing without using DLL's that need registering on the server, and its a total pain.  In ASP.NET if you need to use a DLL you just drop it in a folder and all of it's functionality becomes instantly available - not that you would need to do this probably.

The only downsides are the initilal learning curve, and the slightly higher price for hosting compared with ASP Classic.