Conditional Update based on value of Checkbox

Dear Experts

I am using dreamweaver 8 and sql 2005 and the web pages are coded in ASP VBSCRIPT.

I have a form with 10 file fields and I am using ASP Upload 3 to upload these files and insert 10 values into my database table upon submit.  Please have a look at the following webpage:

http://www.easiproperty.net/CMS/solicitor_estateagency_pdfupload.asp?pRef=134

You will notice in this example there are 6 images down the right hand side of the page.  What I would like to achieve is to invite the user to place their cursor in the appropriate form field then click the image they wish to appear as that image value for the form field.  

For example - on the above web page the 'main property image name is 134_18.jpg - if the user has their cursor in the form field for the main photo and clicks on the main property image - i would like to populate the form field with the image file name.

Can anyone advise?

I attach the code for the page

Thanks

Grant

What I would like to achieve is to only


<%@LANGUAGE="VBSCRIPT"%>
<% Session.LCID = 2057 %>
 
<!--#include file="../Connections/camsmith.asp" -->
 
<!--#include file="../ScriptLibrary/incPU3Class.asp" -->
<!--#include file="../ScriptLibrary/incPU3Utils.asp" -->
<!--#include file="../ScriptLibrary/incPUAddOn.asp" -->
<!--#include file="../ScriptLibrary/incResizeAddOn.asp" -->
 
<%
'*** Pure ASP File Upload 3.0.8
' Process form form1
Dim pau, DMX_uploadAction, UploadRequest, UploadQueryString, pau_thePath, pau_nameConflict, pau_saveWidth, pau_saveHeight
Set pau = new PureUpload
pau.ScriptLibrary = "../ScriptLibrary"
pau.ConflictHandling = "uniq"
pau.StoreType = "file"
pau.ProgressTemplate = "win_look.htm"
pau.ProgressWidth = 400
pau.ProgressHeight = 200
pau.UploadFolder = """../propertyphotos"""
pau.AllowedExtensions = "GIF,JPG,JPEG,BMP,PNG" ' "images"
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
%>
<%
Dim property__MMColParam
property__MMColParam = "1"
If (Request.QueryString("pRef") <> "") Then 
  property__MMColParam = Request.QueryString("pRef")
End If
%>
<%
Dim property
Dim property_numRows
 
Set property = Server.CreateObject("ADODB.Recordset")
property.ActiveConnection = MM_camsmith_STRING
property.Source = "SELECT * FROM dbo.Property WHERE pRef = " + Replace(property__MMColParam, "'", "''") + ""
property.CursorType = 0
property.CursorLocation = 2
property.LockType = 1
property.Open()
 
property_numRows = 0
%>
<%
Dim user__MMColParam
user__MMColParam = "1"
If (Session("MM_Username") <> "") Then 
  user__MMColParam = Session("MM_Username")
End If
%>
<%
Dim user
Dim user_numRows
 
Set user = Server.CreateObject("ADODB.Recordset")
user.ActiveConnection = MM_camsmith_STRING
user.Source = "SELECT * FROM dbo.cmslogin WHERE UserLoginID = '" + Replace(user__MMColParam, "'", "''") + "'"
user.CursorType = 0
user.CursorLocation = 2
user.LockType = 1
user.Open()
 
user_numRows = 0
%>
<%
Dim propertyimages__MMColParam
propertyimages__MMColParam = "9999999999"
If (Request.QueryString("pRef") <> "") Then 
  propertyimages__MMColParam = Request.QueryString("pRef")
End If
%>
<%
Dim propertyimages
Dim propertyimages_cmd
Dim propertyimages_numRows
 
Set propertyimages_cmd = Server.CreateObject ("ADODB.Command")
propertyimages_cmd.ActiveConnection = MM_camsmith_STRING
propertyimages_cmd.CommandText = "SELECT * FROM dbo.PropertyImages WHERE pRefAdd = ? ORDER BY ref DESC" 
propertyimages_cmd.Prepared = true
propertyimages_cmd.Parameters.Append propertyimages_cmd.CreateParameter("param1", 5, 1, -1, propertyimages__MMColParam) ' adDouble
 
Set propertyimages = propertyimages_cmd.Execute
propertyimages_numRows = 0
%>
<%
Dim MM_paramName 
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
 
Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth
 
Dim MM_removeList
Dim MM_item
Dim MM_nextItem
 
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
  MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If
 
MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""
 
' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
  End If
Next
 
' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
  End If
Next
 
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then 
  MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "")  Then
  MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
  MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If
 
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<%
' *** Rename Uploaded Files 1.8.0
If (CStr(Request.QueryString("GP_upload")) <> "") Then
  Dim REUF_renameMask
  REUF_renameMask = property.Fields.Item("pRef").Value & ".jpg"
  RenameUploadedFiles pau_thePath, pau_nameConflict, REUF_renameMask
end if
%>
 
<%
' *** Smart Image Processor 1.1.5
If (CStr(Request.QueryString("GP_upload")) <> "") Then
  Dim RUF_Component, RUF_DotNetResize, RUF_ResizeImages, RUF_AspectImages, RUF_maxWidth, RUF_maxHeight, RUF_Quality, RUF_MakeThumb, RUF_AspectThumb, RUF_Suffix, RUF_maxWidthThumb, RUF_maxHeightThumb, RUF_QualityThumb, RUF_RedirectURL
  RUF_Component = "AUTO"
  RUF_DotNetResize = "../ScriptLibrary/ResizeImage.aspx"
  RUF_ResizeImages = true
  RUF_AspectImages = true
  RUF_maxWidth = "345"
  RUF_maxHeight = "235"  
  RUF_Quality = "80"
  RUF_MakeThumb = false
  RUF_AspectThumb = true
  RUF_Suffix = "_small"
  RUF_maxWidthThumb = ""
  RUF_maxHeightThumb = ""
  RUF_QualityThumb = "70"
  RUF_RedirectURL = ""
  if RUF_ResizeImages then
    ResizeUploadedFiles RUF_Component, RUF_DotNetResize, pau_thePath, "", RUF_maxWidth, RUF_maxHeight, RUF_Quality, true, pau_saveWidth, pau_saveHeight, RUF_AspectImages, pau_nameConflict, ""
  end if
  if RUF_MakeThumb then
    ResizeUploadedFiles RUF_Component, RUF_DotNetResize, pau_thePath, RUF_Suffix, RUF_maxWidthThumb, RUF_maxHeightThumb, RUF_QualityThumb, false, pau_saveWidth, pau_saveHeight, RUF_AspectThumb, pau_nameConflict, ""
  end if
  if RUF_RedirectURL <> "" then
    Response.Redirect RUF_RedirectURL
  end if
end if
%>
 
 
<%
' 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_insert")) = "form1") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd
 
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_camsmith_STRING
    MM_editCmd.CommandText = "INSERT INTO dbo.PropertyImages (pImage, pAddimage1, pAddimage2, pAddimage3, pAddimage4, pAddimage5, pAddimage6, pAddimage7, pAddimage8, pAddimage9, pRefAdd, pESPCref) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" 
    MM_editCmd.Prepared = true 
    
	
	MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 201, 1, 20, UploadFormRequest("file")) ' adLongVarChar
	
	
	
  MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 201, 1, 20, UploadFormRequest("file2")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 201, 1, 20, UploadFormRequest("file3")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201, 1, 20, UploadFormRequest("file4")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 201, 1, 20, UploadFormRequest("file5")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 201, 1, 20, UploadFormRequest("file6")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 201, 1, 20, UploadFormRequest("file7")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 201, 1, 20, UploadFormRequest("file8")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 201, 1, 20, UploadFormRequest("file9")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param10", 201, 1, 20, UploadFormRequest("file10")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param11", 5, 1, -1, MM_IIF(UploadFormRequest("pRefAdd"), UploadFormRequest("pRefAdd"), null)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param12", 5, 1, -1, MM_IIF(UploadFormRequest("pESPCref"), UploadFormRequest("pESPCref"), null)) ' adDouble
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
 
    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "solicitor_estateagency_propertydetails.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
%>
 
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Estate-Agent Solicitor Intelligent Property Management: Upload to Website</title>
 
 
<script type="text/javascript">
<!--
 
 
 
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];}}
}
//-->
</script>
<link href="solicitors_estateagency_styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="p7pm/p7popmenu.js"></script>
<link href="includes/p7pm/p7pmv0.css" rel="stylesheet" type="text/css" />
<style type="text/css">
/*<![CDATA[*/
 
 
 }
 
#scroller {
     
     width: 100%;
     height: 250px;
     border: inset 0px #CCCCCC;
     background: #F6F5F0;
     overflow: auto;
 }
</style>
<script type="text/javascript">
<!--
<%=pau.generateScriptCode()%>
 
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_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>
<script type="text/javascript"><%=pau.generateScriptCode()%></script>
<script src="../ScriptLibrary/incPU3.js" type="text/javascript"></script>
</head>
<body onLoad="P7_initPM(0,0,1,-20,10);MM_preloadImages('../graphics/menu/uploadschedule_ro.jpg')">
<div id ="outerwrapper">
<table width="840" height="75" border="0" cellpadding="0" cellspacing="0" background="../graphics/cms_bg_header.jpg">
    <tr>
      <td><img src="../graphics/menu2/sea_logo.jpg" alt="Solicitor Estate Agency Property Management" width="200" height="75" hspace="0" vspace="0" /></td>
      <td width="640" align="right" valign="bottom"><table width="0" height="70" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td colspan="11"></td>
        </tr>
        <tr>
          <td align="right"><a href="solicitor_estateagency_propertydetails.asp?pRef=<%=(property.Fields.Item("pRef").Value)%>"><img src="../graphics/easi_menu/property_details_active.jpg" alt="Property Details" name="Image12" width="62" height="70" border="0" id="Image12" onMouseOver="MM_swapImage('Image12','','../graphics/easi_menu/property_details_rollover.jpg',1)" onMouseOut="MM_swapImgRestore()" /></a><a href="solicitor_estateagency_propertydetails.asp"></a></td>
          <td align="right"><a href="solicitor_estateagency_createschedule.asp?pRef=<%=(property.Fields.Item("pRef").Value)%>"><img src="../graphics/easi_menu/checklists_active.jpg" alt="Checklists" width="62" height="70" border="0" id="Image4" onMouseOver="MM_swapImage('Image4','','../graphics/easi_menu/checklists_rollover.jpg',1)" onMouseOut="MM_swapImgRestore()" /></a></td>
          <td align="right"><a href="solicitor_estateagency_viewinglist.asp?pRef=<%=(property.Fields.Item("pRef").Value)%>"><img src="../graphics/easi_menu/viewing_appts_active.jpg" alt="Viewing Appointments" width="62" height="70" border="0" id="Image21" onMouseOver="MM_swapImage('Image21','','../graphics/easi_menu/viewing_appts_rollover.jpg',1)" onMouseOut="MM_swapImgRestore()" /></a><a href="solicitor_estateagency_viewinglist.asp?pRef=<%=(property.Fields.Item("pRef").Value)%>"></a></td>
          <td align="right"><a href="solicitor_estateagency_notesofinterestlist.asp?pRef=<%=(property.Fields.Item("pRef").Value)%>"><img src="../graphics/easi_menu/noi_active.jpg" alt="Notes of Interest" width="62" height="70" border="0" id="Image311" onMouseOver="MM_swapImage('Image311','','../graphics/easi_menu/noi_rollover.jpg',1)" onMouseOut="MM_swapImgRestore()" /></a></td>
          <td align="right"><a href="solicitor_estateagency_surveyslist.asp?pRef=<%=(property.Fields.Item("pRef").Value)%>"><img src="../graphics/easi_menu/surveys_active.jpg" alt="Surveys Instructed" name="Image411" width="62" height="70" border="0" id="Image411" onMouseOver="MM_swapImage('Image411','','../graphics/easi_menu/surveys_rollover.jpg',1)" onMouseOut="MM_swapImgRestore()" /></a></td>
          <td align="right"><a href="solicitor_estateagency_offerslist.asp?pRef=<%=(property.Fields.Item("pRef").Value)%>"><img src="../graphics/easi_menu/offers_active.jpg" alt="Offers Received" width="62" height="70" border="0" id="Image511" onMouseOver="MM_swapImage('Image511','','../graphics/easi_menu/offers_rollover.jpg',1)" onMouseOut="MM_swapImgRestore()" /></a></td>
          <td align="right"><a href="solicitor_estateagency_createwindowcard.asp?pRef=<%=(property.Fields.Item("pRef").Value)%>"><img src="../graphics/easi_menu/merge_docs_active.jpg" alt="Merge Documents" name="Image611" width="62" height="70" border="0" id="Image611" onMouseOver="MM_swapImage('Image611','','../graphics/easi_menu/merge_docs_rollover.jpg',1)" onMouseOut="MM_swapImgRestore()" /></a></td>
          <td align="right"><img src="../graphics/easi_menu/upload_current.jpg" alt="Upload Photo/PDF" name="Image5" width="62" height="70" border="0" id="Image5" /></td>
          <td align="right"><a href="solicitor_estateagency_generalnotes.asp?pRef=<%=(property.Fields.Item("pRef").Value)%>"><img src="../graphics/easi_menu/general_notes_active.jpg" alt="General Notes" width="62" height="70" border="0" id="Image6" onMouseOver="MM_swapImage('Image6','','../graphics/easi_menu/general_notes_rollover.jpg',1)" onMouseOut="MM_swapImgRestore()" /></a></td>
          <td><a href="solicitor_estateagency_enquiries.asp?pRef=<%=(property.Fields.Item("pRef").Value)%>"><img src="../graphics/easi_menu/enquiries_active.jpg" alt="Enqruiries" width="62" height="70" border="0" id="Image7" onMouseOver="MM_swapImage('Image7','','../graphics/easi_menu/enquiries_rollover.jpg',1)" onMouseOut="MM_swapImgRestore()" /></a></td>
        </tr>
      </table></td>
    </tr>
  </table>
<div id="maincontent">
 <table width="100%" height="0" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td height="0" colspan="2" valign="top" background="../graphics/menu_cms_bg.gif"></td>
    </tr>
    <tr>
     <td height="30" colspan="2" align="right" valign="middle" id="searchfunction_property"><p>You are logged in as Visitor</p></td>
      </tr>
    <tr>
     
      </tr>
    <tr>
      <td width="185" valign="top" bgcolor="#024B8F"><!--#include file="includes/mainnav_easi.asp" --></td>
      <td valign="top" bgcolor="#FFFFFF">
        <div class="highlight">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="504"><img src="../graphics/menu/photospdf_icon.jpg" alt="Upload to Website" name="Image1" width="60" height="48" hspace="5" border="0" align="left" id="Image1" />
                <h1>Upload Photographs to Website </h1>
                <h2 ><%=(property.Fields.Item("pAddress1").Value)%> , <%=(property.Fields.Item("pAddress2").Value)%> , <%=(property.Fields.Item("pTown").Value)%> , <%=(property.Fields.Item("pPostCode").Value)%></h2></td>
              <td width="136" align="right"><A HREF="solicitor_estateagency_scheduleuploadpdf.asp?<%= Server.HTMLEncode(MM_keepNone) & MM_joinChar(MM_keepNone) & "pRef=" & property.Fields.Item("pRef").Value %>"><img src="../graphics/menu/uploadschedule.jpg" alt="Upload Schedule" width="136" height="48" id="Image2" onMouseOver="MM_swapImage('Image2','','../graphics/menu/uploadschedule_ro.jpg',1)" onMouseOut="MM_swapImgRestore()" /></A></td>
            </tr>
          </table>
        </div>
		 <div id ="formcontainer">
		
		  <table width="100%" height="0" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="100%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="100%" colspan="2" valign="top"><div class="checklist"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2" valign="top"><span class="propertydetailsstatus"><%=(property.Fields.Item("pStage").Value)%>&nbsp;<%=(property.Fields.Item("pClosingDate").Value)%> </span></td>
    </tr>
  <tr>
    <td width="68" valign="top"><p class="propertydetailsheading">Price: </p></td>
    <td width="582" valign="middle"> <p><%=(property.Fields.Item("pPriceType").Value)%> <%= FormatCurrency((property.Fields.Item("pPrice").Value), 0, -2, -2, -2) %><span class="propertydetailsheading"><br />
        </span></p>      </td>
  </tr>
  
</table>
 
		 
 
		</div></td>
        </tr>
      <tr>
        <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="73%" valign="top"><div class="checklist"><form action="<%=MM_editAction%>" method="POST" enctype="multipart/form-data" name="form1" id="form1" onSubmit="<%=pau.submitCode()%>;return document.MM_returnValue">
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="70%" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td height="25" colspan="2"><h2>Add/Edit Property Photographs on Website </h2></td>
                      </tr>
                      <tr>
                        <td height="0" colspan="2"><img src="../graphics/spacer.gif" alt="spacer" width="1" height="5" /></td>
                        </tr>
                      <tr>
                        <td><p class="propertydetailsheading"> Main Photo </p></td>
                        <td width="73%"><label>
                  <input name="file" type="file"  onChange="<%=pau.validateCode()%>" />
                        </label></td>
                      </tr>
                      <tr>
                        <td width="27%"><p class="propertydetailsheading">Photo 2 </p></td>
                        <td>
                            <input name="file2" type="file" <% If Not propertyimages.EOF Or Not propertyimages.BOF Then %>   <% End If ' end Not propertyimages.EOF Or NOT propertyimages.BOF %> onChange="<%=pau.validateCode()%>;return document.MM_returnValue" />
                           
<label></label></td>
                      </tr>
                      <tr>
                        <td><p class="propertydetailsheading">Photo 3 </p></td>
                        <td><input name="file3" type="file" <% If Not propertyimages.EOF Or Not propertyimages.BOF Then %>  <% End If ' end Not propertyimages.EOF Or NOT propertyimages.BOF %> onChange="<%=pau.validateCode()%>;return document.MM_returnValue" /></td>
                      </tr>
                      <tr>
                        <td><p class="propertydetailsheading">Photo 4 </p></td>
                        <td><input name="file4" type="file" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" /></td>
                      </tr>
                      <tr>
                        <td><p class="propertydetailsheading">Photo 5 </p></td>
                        <td><input name="file5" type="file" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" /></td>
                      </tr>
                      <tr>
                        <td valign="top"><p class="propertydetailsheading">Photo 6 </p></td>
                        <td><input name="file6" type="file" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" /></td>
                      </tr>
                      <tr>
                        <td><span class="propertydetailsheading">Photo 7</span></td>
                        <td><input name="file7" type="file" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" /></td>
                      </tr>
                      <tr>
                        <td><span class="propertydetailsheading">Photo 8 </span></td>
                        <td><input name="file8" type="file" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" /></td>
                      </tr>
                      <tr>
                        <td><span class="propertydetailsheading">Photo 9 </span></td>
                        <td><input name="file9" type="file" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" /></td>
                      </tr>
                      <tr>
                        <td><span class="propertydetailsheading">Photo 10 </span></td>
                        <td><input name="file10" type="file" onChange="<%=pau.validateCode()%>;return document.MM_returnValue" /></td>
                      </tr>
                      <tr>
                        <td height="0"><input name="pRefAdd" type="hidden" id="pRefAdd" value="<%=(property.Fields.Item("pRef").Value)%>" />
                          <input name="pESPCref" type="hidden" id="pESPCref" value="<%=(property.Fields.Item("pESPCref").Value)%>" /></td>
                        <td><label>
                          <input name="Submit2" type="submit" class="button" value="Upload" />
                        </label>
                          &nbsp;</td>
                      </tr>
                  </table></td>
                  <td width="30%" valign="top"><div class="viewingappointmentsrights">
                    <% If Not propertyimages.EOF Or Not propertyimages.BOF Then %>
                      <h2>Property Photographs<br />
                        Displayed Main  - Photo 10                      </h2>
                      <div id="scroller">
                        <table width="63%" border="0" align="center" cellpadding="10" cellspacing="0">
                          
						  
						  	<% If Not propertyimages.EOF Or Not propertyimages.BOF Then %>	
						  <tr>
						  <td align="center" bgcolor="#E1E5E8"><p>Main Property Image</p></td>
                              </tr>
						  
						  
						  <tr>
							<td align="center" bgcolor="#E1E5E8"><img src="../propertyphotos/<%=(propertyimages.Fields.Item("pImage").Value)%>" alt="Main Property Image" width="122" height="81" hspace="5" vspace="5" /></td>
                              </tr>
							  <% End If %>
 
 						  	<% If propertyimages.EOF or propertyimages.BOF Then %>	
						  
						  
						  
						  <tr>
							<td align="center" bgcolor="#E1E5E8"><img src="../propertyphotos/<%=(property.Fields.Item("pPhoteFile").Value)%>" alt="Photo to Follow" width="122" height="81" hspace="5" vspace="5" /></td>
                              </tr>
							  <% End If %>
							  
							  
							  
							  
                          <tr>
                            <td align="center"><img src="../graphics/spacer.gif" alt="spacer" width="1" height="1" /></td>
                              </tr>
                         
						 
						 
						 
						 <% if (propertyimages.Fields.Item("pAddimage1").Value) <> "                    " then%>
						  
						  <tr>
						  <td align="center" bgcolor="#E1E5E8"><p>Photo 2</p></td>
                              </tr>
						  
						  <tr>
                            <td align="center" bgcolor="#E1E5E8"><img src="../propertyphotos/<%=(propertyimages.Fields.Item("pAddimage1").Value)%>" alt="Additional Property Image 1" width="122" height="81" hspace="5" vspace="5" /></td>
                              </tr>
							  
							  <%End If%>
							  
                          <tr>
                            <td align="center"><img src="../graphics/spacer.gif" alt="spacer" width="1" height="1" /></td>
                              </tr>
                         
						 
						  <% if (propertyimages.Fields.Item("pAddimage2").Value) <> "                    " then%>
						  
						  <tr>
						  <td align="center" bgcolor="#E1E5E8"><p>Photo 3</p></td>
                              </tr>
						  
						  
						  <tr>
                            <td align="center" bgcolor="#E1E5E8"><img src="../propertyphotos/<%=(propertyimages.Fields.Item("pAddimage2").Value)%>" alt="Additional Property Image 2" width="122" height="81" hspace="5" vspace="5" /></td>
                              </tr>
							  
							  	  <%End If%>
							  
                      
					   <tr>
                            <td align="center"><img src="../graphics/spacer.gif" alt="spacer" width="1" height="1" /></td>
                              </tr>
					  
					  
					   <tr>
					    <% if (propertyimages.Fields.Item("pAddimage3").Value) <> "                    " then%>
					     
						 <tr>
						  <td align="center" bgcolor="#E1E5E8"><p>Photo 4</p></td>
                              </tr>
						 
						  <tr>
                            <td align="center" bgcolor="#E1E5E8"><img src="../propertyphotos/<%=(propertyimages.Fields.Item("pAddimage3").Value)%>" alt="Additional Property Image 3" width="122" height="81" hspace="5" vspace="5" /></td>
                              </tr>
                          	  <%End If%>
						 
						  <tr>
                            <td align="center"><img src="../graphics/spacer.gif" alt="spacer" width="1" height="1" /></td>
                              </tr>
						 
					  <% if (propertyimages.Fields.Item("pAddimage4").Value) <> "                    " then%>	 
						  
						  <tr>
						  <td align="center" bgcolor="#E1E5E8"><p>Photo 5</p></td>
                              </tr>
						  
						  
						  <tr>
                            <td align="center" bgcolor="#E1E5E8"><img src="../propertyphotos/<%=(propertyimages.Fields.Item("pAddimage4").Value)%>" alt="Additional Property Image 4" width="122" height="81" hspace="5" vspace="5" /></td>
                              </tr>
                            <%End If%>
                           <tr>
                            <td align="center"><img src="../graphics/spacer.gif" alt="spacer" width="1" height="1" /></td>
                              </tr>
						  
						    <% if (propertyimages.Fields.Item("pAddimage5").Value) <> "                    " then%>
						 
						 <tr>
						  <td align="center" bgcolor="#E1E5E8"><p>Photo 6</p></td>
                              </tr>
						 
						  <tr>
                            <td align="center" bgcolor="#E1E5E8"><img src="../propertyphotos/<%=(propertyimages.Fields.Item("pAddimage5").Value)%>" alt="Additional Property Image 5" width="122" height="81" hspace="5" vspace="5" /></td>
                              </tr>
                                 <%End If%>
                         
						 <tr>
                            <td align="center"><img src="../graphics/spacer.gif" alt="spacer" width="1" height="1" /></td>
                              </tr>
						
						
						
						  <% if (propertyimages.Fields.Item("pAddimage6").Value) <> "                    " then%>
						  
						 <tr>
						  <td align="center" bgcolor="#E1E5E8"><p>Photo 7</p></td>
                              </tr> 
						  
						  
						  <tr>
                            <td align="center" bgcolor="#E1E5E8"><img src="../propertyphotos/<%=(propertyimages.Fields.Item("pAddimage6").Value)%>" alt="Additional Property Image 6" width="122" height="81" hspace="5" vspace="5" /></td>
                              </tr>
							   <%End If%>
                          
                           <tr>
                            <td align="center"><img src="../graphics/spacer.gif" alt="spacer" width="1" height="1" /></td>
                              </tr>
						  
						 	  <% if (propertyimages.Fields.Item("pAddimage7").Value) <> "                    " then%> 
						 
						 <tr>
						  <td align="center" bgcolor="#E1E5E8"><p>Photo 8</p></td>
                              </tr>
						 
						  <tr>
                            <td align="center" bgcolor="#E1E5E8"><img src="../propertyphotos/<%=(propertyimages.Fields.Item("pAddimage7").Value)%>" alt="Additional Property Image 7" width="122" height="81" hspace="5" vspace="5" /></td>
                              </tr>	
                             <%End If%>
                         
						 
						  <tr>
                            <td align="center"><img src="../graphics/spacer.gif" alt="spacer" width="1" height="1" /></td>
                              </tr>
						 
						 
						 
							  <% if (propertyimages.Fields.Item("pAddimage8").Value) <> "                    " then%> 
						 
						 <tr>
						  <td align="center" bgcolor="#E1E5E8"><p>Photo 9</p></td>
                              </tr>
						 
						  <tr>
                            <td align="center" bgcolor="#E1E5E8"><img src="../propertyphotos/<%=(propertyimages.Fields.Item("pAddimage8").Value)%>" alt="Additional Property Image 8" width="122" height="81" hspace="5" vspace="5" /></td>
                              </tr>
							   <%End If%>
							
							 <tr>
                            <td align="center"><img src="../graphics/spacer.gif" alt="spacer" width="1" height="1" /></td>
                              </tr>
							
							
							
							  
                            <% if (propertyimages.Fields.Item("pAddimage9").Value) <> "                    " then%> 
                         
						 <tr>
						  <td align="center" bgcolor="#E1E5E8"><p>Photo 10</p></td>
                              </tr>
						 
						 
						  <tr>
                            <td align="center" bgcolor="#E1E5E8"><img src="../propertyphotos/<%=(propertyimages.Fields.Item("pAddimage9").Value)%>" alt="Additional Property Image 9" width="122" height="81" hspace="5" vspace="5" /></td>
                              </tr>		
							     <%End If%>
							 
							 
							 <tr>
                            <td align="center"><img src="../graphics/spacer.gif" alt="spacer" width="1" height="1" /></td>
                              </tr> 
							 
							  
                          
                          	  <% if (propertyimages.Fields.Item("pAddimage10").Value) <> "                    " then%> 
                          
						  <tr>
						  <td align="center" bgcolor="#E1E5E8"><p>Photo 11</p></td>
                              </tr>
						  
						  <tr>
                            <td align="center" bgcolor="#E1E5E8"><img src="../propertyphotos/<%=(propertyimages.Fields.Item("pAddimage10").Value)%>" alt="Additional Property Image 10" width="122" height="81" hspace="5" vspace="5" /></td>
                              </tr>
							     <%End If%>
							  
                       
					    <tr>
                            <td align="center"><img src="../graphics/spacer.gif" alt="spacer" width="1" height="1" /></td>
                              </tr>
					   
					   
					    </table>
                      </div>
                      <% End If ' end Not propertyimages.EOF Or NOT propertyimages.BOF %>
</div></td>
                </tr>
              </table>
              <input type="hidden" name="MM_insert" value="form1">
            </form></div></td>
            </tr>
          
        </table></td>
        </tr>
      
      
    </table>    </td>
  </tr>
</table>
        </div></td>
    </tr>
  </table>
</div>
</div>
<!--#include file="includes/footer.asp" -->
</body>
</html>
<%
property.Close()
Set property = Nothing
%>
<%
user.Close()
Set user = Nothing
%>
<%
propertyimages.Close()
Set propertyimages = Nothing
%>

Open in new window

grantballantyneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mfsamuelCommented:
With javascript this should be simple.  Each field should have an onfocus even that calls a function that sets the current active field.  Then add an onclick event to each photo that enters the URL into the currently active field.

This is not the most elegant solution I have seen but it should work.  Alternatively you can use something like drag and drop functionality.  This will look much nicer and should be more intuative to your users.  See the below link for dran and drop examples.

http://wiki.script.aculo.us/scriptaculous/show/DragAndDrop

If you really want to do the click photo option and are having trouble with the code I can mach something up for you.  Let me know which is the prefered solution.
0
grantballantyneAuthor Commented:
Thanks mfsamuel

I really like the drag and drop functionality as per your http://wiki.script.aculo.us/scriptaculous/show/DragAndDrop link.

Can you give me anymore help/guidance as to how I could incorpoate this into my page.

I would like to drag the property images across to the form field and populate the form field with the image file name.

Thanks again

Grant
0
mfsamuelCommented:
so here is the problem we are faced with.  I am not sure why i didn't think of this sooner.

javascript cannot change the value of a file input for security reasons.  no matter how elegant the user interface is we have that issue.

what you can do is unfortunately fairly complicated.  you can create an interface similar to an email client wich allow you to browse and upload independantly of the selection process.

example:
1) give them 1 upload button that they can submit multiple times.
2) then next step displays all the photos they have online (existing and ones recently uploaded.)
3) create a form with text fields not file that can be dropped on.
4) submit that form to record their selections.

In this example you can prefill the second form with their current selection or if they just want to change the order they can skip the upload piece entirely.  Let me know if this makes sense or if you need more of a description.

Below is working drag/drop code for the second piece.  You will need to get the scripts above and change any paths to files for the demo to work.
<script src="scriptaculous/lib/prototype.js" type="text/javascript"></script>
<script src="scriptaculous/src/scriptaculous.js" type="text/javascript"></script>
 
<img src="134_18.jpg" width="122" height="81" hspace="5" vspace="5" alt="134_18.jpg" class="property" id="property1"/>
<input name="filefield1" id="filefield1" type="text" />
<script type="text/javascript" language="javascript">
 new Draggable('property1', {revert:true} );
 
 Droppables.add('filefield1', {
   accept: 'property',
   onDrop: function(element) 
     { $('filefield1').value=element.src}});
</script>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
grantballantyneAuthor Commented:
mfsamuel - thanks very much for your help with this
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.