Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 567
  • Last Modified:

onclick="doIt()"> works in PC IE but not on mac Safari or Firefox

I built this simple little javascript program to pull from data from one form to populate some hidden values in another form. Basically my page has 2 forms and one submits to a shopping cart and one to a registry cart.  Products have lots of configurable details, so when they make the selections in one form, I have to capture that in the other form when they click "add to registry'

<script type="text/javascript">
function doIt() {
document.getElementById('size2').value = document.getElementById('size').value;
document.getElementById('opt1').value = document.getElementById('Option1').value;
document.getElementById('opt2').value = document.getElementById('Option2').value;
document.getElementById('opt3').value = document.getElementById('Option3').value;
document.getElementById('persregistry').value = document.getElementById('Presonalize').value;
}
</script>

<input type="image" src="Images/addregistrybutton.gif" border="0" value="Add To Cart" name="registry_1_ATC" onclick="doIt();" alt="Add to Registry" />

Our site is live and I've made so many changes on Dev, I'm frozen to make other needed changes.  I really appreciate any suggestions.  90% of my customers are on PCs, but the 10% on macs would get an error every time they used the registry system :(
0
stroudtx
Asked:
stroudtx
  • 10
  • 6
  • 3
1 Solution
 
_Maddog_Commented:
Hi stroudtx,

What kind of errors are they getting?
At first glance, the code seems fine.

- Maddog
0
 
stroudtxAuthor Commented:
It's not executing the code, so when I try and cDbl the hidden field it is Null and I get an error.

I agree, which is why I've spent the past 3 hours trying to debug it :(

Thanks!!

Mike
0
 
_Maddog_Commented:
Hmm...

Can you post the entire page? or at least the relevant portion?

Basically, the only reason for this code to generate errors, is if the elements it is trying to update (or the elements it takes the info from) don't exist.

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
stroudtxAuthor Commented:
here is another page with the same problem, just 1 field instead of the 5 above....


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!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>Detailed Product View</title>
<%
Session("Current_page_URL") = "http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL") & "?" & Request.ServerVariables("QUERY_STRING")
%>
<%
Session("referred") = Request.ServerVariables("HTTP_REFERER")
%>
<%
If Session("referred") <> "" Then
Session("V1")=Instr(Session("referred"),"http://")
Session("V2")=Instr(Session("referred"),".com")
Session("V3")=Instr(Session("referred"),".net")
%>
<%
Session("V2")=(Session("V2")+Session("V3")-Session("V1")-3)
%>
<%
Session("V1")=(Session("V1")+7)
If Session("V2")>49 Then
Session("V2")=20
End if
If Session("V2")>0 Then
Session("URLString")=Mid(Session("referred"),Session("V1"),Session("V2"))
End if
End if
%>
<%
If Instr(Session("URLString"),"dimplesanddandelions")=0 Then
If Session("URLString") <> "" Then
Response.Cookies("sourcesite")=Session("URLString")
Response.Cookies("sourcesite").Expires=Date+30
End if
End if
%>
<link href="css/style.css" rel="stylesheet" type="text/css" />

<script language="JavaScript" type="text/javascript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
<script language="JavaScript" type="text/javascript">

function right(e) {
var msg = "right-click is disabled for image protection.";
if (navigator.appName == 'Netscape' && e.which == 3) {
alert(msg);
return false;
}
if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
alert(msg);
return false;
}
else return true;
}

function trap()
  {
  if(document.images)
    {
    for(i=0;i<document.images.length;i++)
      {
      document.images[i].onmousedown = right;
      document.images[i].onmouseup = right;
      }
    }
  }
// End -->
</script>
<script type="text/javascript">
function doIt() {
document.getElementById('size2').value = document.getElementById('size').value;
}
</script>
<link href="WA_eCart/CSS/WAeCartStyles_S1c.css" rel="stylesheet" type="text/css" />

<!--#include file="WA_eCart/WA_eCart_Definition_VB.asp" -->
<!--#include file="WA_eCart/registry_VB.asp" -->
<!--#include file="WA_eCart/eCart_VB.asp" -->
<!--#include file="Connections/mysql_db.asp" -->
<%
Dim product_details__MMColParam
product_details__MMColParam = "1"
If (Request.QueryString("Product_ID")  <> "") Then
  product_details__MMColParam = Request.QueryString("Product_ID")
End If
%>
<%
Dim product_details
Dim product_details_numRows

Set product_details = Server.CreateObject("ADODB.Recordset")
product_details.ActiveConnection = MM_mysql_db_STRING
product_details.Source = "SELECT products.Product_ID, products.Mfg_ID, products.Category_ID,  products.Gift_ID,  products.Sex,  products.Product_Name,  products.Long_Description,  products.Description2,  products.Dimensions,  products.Ships_In,  products.Ship_Method,  products.Personable,  products.Freight,  products.Weight,  products.Collection,  products.Cost,  products.Price,  products.Sale_Price,  products.Related_A,  products.Related_B,  products.Catalog_URL,  products.Catalog_Detail,  products.Catalog2_URL,  products.Catalog3_URL,  products.Catalog4_URL,  products.Option_Pic,  products.Smallpic,  products.Main_Option,  products.Option1_Name,  products.Option2_Name,  products.Option3_Name,  products.Option4_Name,  manufacturers.Forward  FROM manufacturers  Inner Join products ON products.Mfg_ID = manufacturers.Mfg_ID  WHERE Product_ID = " + Replace(product_details__MMColParam, "'", "''") + ""
product_details.CursorType = 2
product_details.CursorLocation = 3
product_details.LockType = 1
product_details.Open()

product_details_numRows = 0
%>
<% ' Redirect if needed
If (product_details.Fields.Item("Forward").Value <> "") Then
Redirect=(product_details.Fields.Item("Forward").Value)&"?Product_ID="&(product_details.Fields.Item("Product_ID").Value)
Response.Redirect(Redirect)
end if
%>
<script type="text/javascript">
function openwindow()
{
window.open("http://www.dimplesanddandelions.com/zoom.asp?Display=1&Product_ID=<%=(product_details.Fields.Item("Product_ID").Value)%>","Details", "toolbar=no,location=no,directories=no, status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=400,height=475")
}
</script>
<%
Dim product_sizes__MMColParam
product_sizes__MMColParam = "1"
If (Request.QueryString("product_id") <> "") Then
  product_sizes__MMColParam = Request.QueryString("product_id")
End If
%>
<%
Dim product_sizes
Dim product_sizes_numRows

Set product_sizes = Server.CreateObject("ADODB.Recordset")
product_sizes.ActiveConnection = MM_mysql_db_STRING
product_sizes.Source = "SELECT Detail_ID, Product_ID_Detail, Size_Option, Inventory_Count  FROM mysql_store.product_details  WHERE Product_ID_Detail = " + Replace(product_sizes__MMColParam, "'", "''") + " and Inventory_Count > 0"
product_sizes.CursorType = 0
product_sizes.CursorLocation = 2
product_sizes.LockType = 1
product_sizes.Open()

product_sizes_numRows = 0
%>
<%
Dim rsRelated_A__MMColParam
rsRelated_A__MMColParam = "0"
If (product_details.Fields.Item("Related_A").Value  <> "") Then
  rsRelated_A__MMColParam = product_details.Fields.Item("Related_A").Value
End If
%>
<%
Dim rsRelated_A
Dim rsRelated_A_numRows

Set rsRelated_A = Server.CreateObject("ADODB.Recordset")
rsRelated_A.ActiveConnection = MM_mysql_db_STRING
rsRelated_A.Source = "SELECT Product_ID, Product_Name, Price, Sale_Price, Smallpic  FROM mysql_store.products  WHERE Product_ID = " + Replace(rsRelated_A__MMColParam, "'", "''") + ""
rsRelated_A.CursorType = 0
rsRelated_A.CursorLocation = 2
rsRelated_A.LockType = 1
rsRelated_A.Open()

rsRelated_A_numRows = 0
%>
<%
Dim rsRelated_B__MMColParam
rsRelated_B__MMColParam = "0"
If (product_details.Fields.Item("Related_B").Value  <> "") Then
  rsRelated_B__MMColParam = product_details.Fields.Item("Related_B").Value
End If
%>
<%
Dim rsRelated_B
Dim rsRelated_B_numRows

Set rsRelated_B = Server.CreateObject("ADODB.Recordset")
rsRelated_B.ActiveConnection = MM_mysql_db_STRING
rsRelated_B.Source = "SELECT Product_ID, Product_Name, Price, Sale_Price, Smallpic  FROM mysql_store.products  WHERE Product_ID = " + Replace(rsRelated_B__MMColParam, "'", "''") + ""
rsRelated_B.CursorType = 0
rsRelated_B.CursorLocation = 2
rsRelated_B.LockType = 1
rsRelated_B.Open()

rsRelated_B_numRows = 0
%>
<%
' WA eCart AddToCart
if (cStr(Request.Form("eCart_1_ATC")) <> "" OR cStr(Request.Form("eCart_1_ATC.x")) <> "")     then
  ATC_itemID = cStr(Request.Form("eCart_1_ID_Add"))
  ATC_AddIfIn = 0
  ATC_RedirectAfter = "view_cart.asp"
  ATC_RedirectIfIn  = ""
  ATC_RSPos = product_details.AbsolutePosition
  product_details.MoveFirst()
  DO while (NOT product_details.EOF)
    if (cStr(product_details.Fields("Product_ID").value) = cStr(ATC_itemID))  then
      ATC_itemName = "" & cStr((product_details.Fields.Item("Product_Name").Value)) & ""' column binding
      ATC_itemDescription = ""' column binding
      ATC_itemWeight = cDbl("" & cStr((product_details.Fields.Item("Weight").Value)) & "")' column binding
      ATC_itemQuantity = "" & cStr(Request.Form("eCart_1_Quantity_Add")) & ""' column binding
      ATC_itemPrice = cDbl("" & cStr(WA_eCart_IIf(isNull(product_details.Fields("Sale_Price").value), product_details.Fields("Price").value, product_details.Fields("Sale_Price").value)) & "")' column binding
      ATC_itemSize = "" & cStr(cStr(Request.Form("size"))) & ""' column binding
      ATC_itemOption1Cost = cDbl("0")' column binding
      ATC_itemOption1 = ""' column binding
      ATC_itemOption2Cost = cDbl("0")' column binding
      ATC_itemOption2 = ""' column binding
      ATC_itemOption3 = ""' column binding
      ATC_itemOption4 = "" & cStr(cStr(Request.Form("Presonalize"))) & ""' column binding
      ATC_itemOption3Cost = cDbl("0")' column binding
      ATC_itemOption4Cost = cDbl("0")' column binding
      Exit DO
    end if
    product_details.MoveNext()
  Loop
  product_details.AbsolutePosition = ATC_RSPos
  if (IsNumeric(ATC_itemQuantity) AND ATC_itemQuantity <> 0)     then
    set eCart = eCart_AddToCart(ATC_AddIfIn, ATC_RedirectIfIn, ATC_itemID, ATC_itemName, ATC_itemDescription, ATC_itemWeight, ATC_itemQuantity, ATC_itemPrice, ATC_itemSize, ATC_itemOption1Cost, ATC_itemOption1, ATC_itemOption2Cost, ATC_itemOption2, ATC_itemOption3, ATC_itemOption4, ATC_itemOption3Cost, ATC_itemOption4Cost)
    if (ATC_RedirectAfter <> "" AND eCart_redirStr = "")     then
      eCart_redirStr = ATC_RedirectAfter
    end if
    Session("WAEC_ContinueRedirect") = cStr(Request.ServerVariables("Script_Name"))  & "?" & cStr(Request.QueryString())
  end if
end if
%>
<%
' WA eCart AddToCart
if (cStr(Request.Form("registry_1_ATC")) <> "" OR cStr(Request.Form("registry_1_ATC.x")) <> "")     then
  ATC_itemID = cStr(Request.Form("registry_1_ID_Add"))
  ATC_AddIfIn = 0
  ATC_RedirectAfter = "add_registry.asp"
  ATC_RedirectIfIn  = ""
  ATC_RSPos = product_details.AbsolutePosition
  product_details.MoveFirst()
  DO while (NOT product_details.EOF)
    if (cStr(product_details.Fields("Product_ID").value) = cStr(ATC_itemID))  then
      ATC_itemName = "" & cStr((product_details.Fields.Item("Product_Name").Value)) & ""' column binding
      ATC_itemDescription = ""' column binding
      ATC_itemWeight = cDbl("" & cStr((product_details.Fields.Item("Weight").Value)) & "")' column binding
      ATC_itemQuantity = cDbl("1")' column binding
      ATC_itemPrice = cDbl("" & cStr(WA_eCart_IIf(isNull(product_details.Fields("Sale_Price").value), product_details.Fields("Price").value, product_details.Fields("Sale_Price").value)) & "")' column binding
      ATC_itemSize = "" & cStr(cStr(Request.Form("size2"))) & ""' column binding
      ATC_itemOption1Cost = cDbl("0")' column binding
      ATC_itemOption2Cost = cDbl("0")' column binding
      ATC_itemOption3Cost = cDbl("0")' column binding
      ATC_itemOption4Cost = cDbl("0")' column binding
      ATC_itemOption1 = ""' column binding
      ATC_itemOption2 = ""' column binding
      ATC_itemOption3 = ""' column binding
      ATC_itemOption4 = "" & cStr(cStr(Request.Form("Presonalize"))) & ""' column binding
      Exit DO
    end if
    product_details.MoveNext()
  Loop
  product_details.AbsolutePosition = ATC_RSPos
  if (IsNumeric(ATC_itemQuantity) AND ATC_itemQuantity <> 0)     then
    set registry = registry_AddToCart(ATC_AddIfIn, ATC_RedirectIfIn, ATC_itemID, ATC_itemName, ATC_itemDescription, ATC_itemWeight, ATC_itemQuantity, ATC_itemPrice, ATC_itemSize, ATC_itemOption1Cost, ATC_itemOption2Cost, ATC_itemOption3Cost, ATC_itemOption4Cost, ATC_itemOption1, ATC_itemOption2, ATC_itemOption3, ATC_itemOption4)
    if (ATC_RedirectAfter <> "" AND registry_redirStr = "")     then
      registry_redirStr = ATC_RedirectAfter
    end if
    Session("WAEC_ContinueRedirect") = cStr(Request.ServerVariables("Script_Name"))  & "?" & cStr(Request.QueryString())
  end if
end if
%>
<%
' WA eCart Redirect
if (eCart_redirStr <> "")     then
  Response.Redirect(eCart_redirStr)
end if
%>
<%
' WA eCart Redirect
if (registry_redirStr <> "")     then
  Response.Redirect(registry_redirStr)
end if
%>
</head>

<body onload="trap()">
<div id="wrapper">

<a href="index.asp"><img src="Images/store_header.gif" width="800" height="110" border="0" class="header" /></a>

<span class="home"><a href="index.asp">Return Home</a></span>
<span class="text2"><a href="view_cart.asp">View Cart</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="https://www.dimplesanddandelions.com/checkout_signin.asp">Checkout</a><br />
<a href="my_account.asp">My Account</a></span>
<span class="detailsbox4c">&nbsp;</span>
<span class="bottomtext4c">
<a href="index.asp">HOME</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="about_us.asp">ABOUT US</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="contact_us.asp">CONTACT US</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="customer_service.asp">CUSTOMER SERVICE</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="links.asp">LINKS</a></span><a href="index.asp"><img src="Images/store_header.gif" width="800" height="110" border="0" class="header" /></a>
<span class="department">Shop one of our fine departments</span>

<form action="search_results.asp" method="post" name="Search"
 class="searchproducts" id="Search">
<input name="product_search" type="text" id="product_search" value="enter keyword" size="17" />

<input name="imageField" type="image" src="Images/go_button.gif" align="top" width="50" height="18" border="0" />
</form>

<img src="Images/pinkline.gif" width="800" height="5" class="pinkline" /><img src="Titles/productdetails.gif" alt="Product Details" class="infotextlocation" />
<img src="Images/bottomline.gif" width="800" height="15" class="bottomline4c" />

<span class="staticmenu"><img src="Images/menu.gif" width="800" height="24" border="0" usemap="#Menu" />    
<map name="Menu" id="Menu">
      <area shape="rect" coords="0,0,90,24" href="clothing.asp" alt="Clothing" />
      <area shape="rect" coords="90,0,140,24" href="babygifts.asp" alt="Gifts" />
      <area shape="rect" coords="140,0,210,24" href="mommy_shop.asp" alt="Mommy Shop" />
      <area shape="rect" coords="210,0,305,24" href="designer_diaper_bags.asp" alt="Designer Diaper Bags" /><area shape="rect" coords="550,0,621,24" href="sale_shop.asp" alt="On Sale" />
      <area shape="rect" coords="305,0,435,24" href="designer_rooms.asp" alt="Designer Rooms" />
      <area shape="rect" coords="435,0,550,24" href="designer_shop.asp" alt="Shop By Brand" />
     
      <area shape="rect" coords="621,0,716,24" href="new_arrivals.asp" alt="New Arrivals" />
        <area shape="rect" coords="715,0,800,24" href="baby_registry.asp" alt="Gift Registry" />
 </map></span>

<% If NOT product_details.EOF And NOT product_details.BOF Then %>
<% If Not rsRelated_A.EOF Or Not rsRelated_A.BOF Then %>
<img src="Images/Wealsosuggest.gif" alt="Might we suggest" width="350" height="45" class="mightwesuggesttext" />
<table width="338" border="0" cellpadding="2" cellspacing="0" class="detailrelatedtableright">
  <tr>
    <td width="140"><div align="left"><a href="product_detail.asp?Product_ID=<%=(rsRelated_A.Fields.Item("Product_ID").Value)%>"><img src="<%=(rsRelated_A.Fields.Item("Smallpic").Value)%>" name="Featured_A" height="160" border="0" id="Featured_A" /></a></div></td>
    <td width="210" valign="top"><div align="left"><br /><strong><%=(rsRelated_A.Fields.Item("Product_Name").Value)%></strong>
    </div>       
      <br />
      <%
If (rsRelated_A.Fields.Item("Sale_Price").Value <> "") Then
Response.write "Regular Price: " & FormatCurrency((rsRelated_A.Fields.Item("Price").Value), -1, -2, -2, -2) & "<br />"%>
    <span class="redalert">
<% Response.write "Sale Price: " & FormatCurrency((rsRelated_A.Fields.Item("Sale_Price").Value), -1, -2, -2, -2) & "<br />"
%>
    </span>
    <% Else
Response.write "Price: " & FormatCurrency((rsRelated_A.Fields.Item("Price").Value), -1, -2, -2, -2) & "<br />"
End if %>    <br />    <a href="product_detail.asp?Product_ID=<%=(rsRelated_A.Fields.Item("Product_ID").Value)%>"><br />
    <u>Click here for details</u></a></td>
    </tr>
</table>
<% End If%>

<% If Not rsRelated_B.EOF Or Not rsRelated_B.BOF Then %>
<table width="338" border="0" cellpadding="2" cellspacing="0" class="detailrelatedtableleft">
    <tr>
      <td width="140"><div align="left">      <a href="product_detail.asp?Product_ID=<%=(rsRelated_B.Fields.Item("Product_ID").Value)%>"><img src="<%=(rsRelated_B.Fields.Item("Smallpic").Value)%>" name="Featured_A" height="160" border="0" id="Featured_A" /></a></div></td>
      <td width="210" valign="top"><div align="left"><br /><strong><%=(rsRelated_B.Fields.Item("Product_Name").Value)%></strong>
      </div>       
        <br />
        <%
If (rsRelated_B.Fields.Item("Sale_Price").Value <> "") Then
Response.write "Regular Price: " & FormatCurrency((rsRelated_B.Fields.Item("Price").Value), -1, -2, -2, -2) & "<br />"%>
      <span class="redalert">
  <% Response.write "Sale Price: " & FormatCurrency((rsRelated_B.Fields.Item("Sale_Price").Value), -1, -2, -2, -2) & "<br />"
%>
      </span>
      <% Else
Response.write "Price: " & FormatCurrency((rsRelated_B.Fields.Item("Price").Value), -1, -2, -2, -2) & "<br />"
End if %>    <br />    <a href="product_detail.asp?Product_ID=<%=(rsRelated_B.Fields.Item("Product_ID").Value)%>"><br />
     <u>Click here for details<u></a></td>
    </tr>
</table>
<% End If ' end Not rsRelated_B.EOF Or NOT rsRelated_B.BOF %>

<table border="0" cellpadding="0" cellspacing="0" class="addtocarttable">
  <tr>
    <td valign="top"><div align="center">
<a href="javascript:;" onclick="openwindow()"><img src="<%=(product_details.Fields.Item("Catalog_Detail").Value)%>" border="0" galleryimg="no" /></a>
          <br />
<a href="javascript:;" onclick="openwindow()"><strong>Click for more Images</strong></a><% If (product_details.Fields.Item("Collection").Value) <> "" Then%>
    <br />
    <br />
    <strong>View the <a href="designer_gallery.asp?Mfg_Id=<%=(product_details.Fields.Item("Mfg_ID").Value)%>"><u>Entire Collection</u></a></strong>
    <% End if %>
          <% End if %>
      </div></td>
    <td width="20">&nbsp;</td>
    <td><strong><%=(product_details.Fields.Item("Product_Name").Value)%></strong>
      <br />
      <br />
<%=(product_details.Fields.Item("Long_Description").Value)%>&nbsp;<%=(product_details.Fields.Item("Description2").Value)%>
<br /><br />
<% If Not product_sizes.EOF Or Not product_sizes.BOF Then %>
<% If (product_details.Fields.Item("Sale_Price").Value <> "") Then
Response.write "Regular Price: " & FormatCurrency((product_details.Fields.Item("Price").Value), -1, -2, -2, -2)%><br />
<span class="redalert"><% Response.write "Sale Price: " & FormatCurrency((product_details.Fields.Item("Sale_Price").Value), -1, -2, -2, -2)%></span><br /><br />
<% Else
Response.write "Price: " & FormatCurrency((product_details.Fields.Item("Price").Value), -1, -2, -2, -2)%> <br /><br />
<%End if%>
<% End If ' end Not product_sizes.EOF Or NOT product_sizes.BOF %>
<% If product_sizes.EOF And product_sizes.BOF Then %>
Sorry, this item is sold out.
<% End If ' end product_sizes.EOF And product_sizes.BOF %>
<% If (product_details.Fields.Item("Ships_In").Value) <> "" Then %>
 <strong>Ships in:&nbsp;&nbsp;</strong><%=(product_details.Fields.Item("Ships_In").Value)%>
<br /><br /><% End if %>
<form action="<%=cStr(Request.ServerVariables("SCRIPT_NAME"))%><%=WA_eCart_IIf((Request.ServerVariables("QUERY_STRING") <> ""), "?" & Request.ServerVariables("QUERY_STRING"), "")%>" method="post" name="eCart_1_ATC_<%=product_details.Fields("Product_ID").value%>" id="eCart_1_ATC_<%=product_details.Fields("Product_ID").value%>">
        <% If Not product_sizes.EOF Or Not product_sizes.BOF Then %>
          <% If Not (product_sizes.Fields.Item("Size_Option").Value ="n/a") Then %>
        <select name="size" id="size" >
          <%
While (NOT product_sizes.EOF)
%>
          <option value="<%=(product_sizes.Fields.Item("Size_Option").Value)%>"><%=(product_sizes.Fields.Item("Size_Option").Value)%></option>
          <%
  product_sizes.MoveNext()
Wend
If (product_sizes.CursorType > 0) Then
  product_sizes.MoveFirst
Else
  product_sizes.Requery
End If
%>
        </select>
     &nbsp;&nbsp; Available Sizes in stock  <br /><br />
        <% End If ' end Not product_sizes.EOF Or NOT product_sizes.BOF %>
          <% End if ' end For product with n/a %><br />

          <% If Not product_sizes.EOF Or Not product_sizes.BOF Then %>
          <% If  (product_sizes.Fields.Item("Size_Option").Value ="n/a") Then %>
        <input name="size" type="hidden" value="n/a" />
          <% End if %>
          <% End if %>
            

          <input type="hidden" name="eCart_1_ID_Add" value="<%=product_details.Fields("Product_ID").value%>" />      
              <% If Not product_sizes.EOF Or Not product_sizes.BOF Then %>
          
        <input name="eCart_1_Quantity_Add" type="text" value="1" size="1" maxlength="2" />
  Quantity&nbsp;
  <% End If ' end Not product_sizes.EOF Or NOT product_sizes.BOF %>
  <% If (product_details.Fields.Item("Personable").Value) = "Y" Then %>
    <br /><br /><strong>Personalize Your Item:&nbsp;</strong><br />
    <input name="Presonalize" type="text" id="Presonalize" size="50" maxlength="50" />
    <% End if %>
          <br /><br />
 <% If Not product_sizes.EOF Or Not product_sizes.BOF Then %>
  <input type="image" src="Images/addtocart_button.gif" border="0" value="Add To Cart" name="eCart_1_ATC" alt="add to cart">
          <% End If ' end Not product_sizes.EOF Or NOT product_sizes.BOF %></form>
<br />              
<form name="registry_1_ATC_<%=(product_details.Fields.Item("Product_ID").Value)%>" method="POST" action="<%=cStr(Request.ServerVariables("SCRIPT_NAME"))%><%=WA_eCart_IIf((Request.ServerVariables("QUERY_STRING") <> ""), "?" & Request.ServerVariables("QUERY_STRING"), "")%>">
            <input type="hidden" name="registry_1_ID_Add" value="<%=product_details.Fields("Product_ID").value%>" />
<input type="hidden" name="size2" >
<% If Not product_sizes.EOF Or Not product_sizes.BOF Then %>
  <input name="registry_1_ATC" type="image" onclick="doIt()" value="Add To Cart" src="Images/addregistrybutton.gif" alt="Add to Registry" border="0">
  <% End If ' end Not product_sizes.EOF Or NOT product_sizes.BOF %>
</form>
<br />
<a href="#" onclick="MM_openBrWindow('recommend.asp?product_ID=<%=(product_details.Fields.Item("Product_ID").Value)%>','Recommend','resizable=yes,width=450,height=400')"><img src="Images/email.jpg" alt="email" width="60" height="32" border="0" /><u>Click Here</u></a> to email this item to your friend
          <br />
          <br />
          <strong>Need help?</strong><br />
  Please call 1- 888-431-6377 M-F 9 AM - 5 PM CST or
  email <br />
  us anytime at <a href="mailto
:customerservice@dimplesanddandelions.com">&#099;&#117;&#115;&#116;&#111;&#109;&#101;&#114;&#115;&#101;&#114;&#118;&#105;&#099;&#101;&#064;&#100;&#105;&#109;&#112;&#108;&#101;&#115;&#097;&#110;&#100;&#100;&#097;&#110;&#100;&#101;&#108;&#105;&#111;&#110;&#115;&#046;&#099;&#111;&#109;</a>

      </td>
  </tr>
</table>
</div>
</body>
</html>
<%
product_details.Close()
Set product_details = Nothing
%>
<%
product_sizes.Close()
Set product_sizes = Nothing
%>
<%
rsRelated_A.Close()
Set rsRelated_A = Nothing
%>
<%
rsRelated_B.Close()
Set rsRelated_B = Nothing
%>
0
 
_Maddog_Commented:
Well, here the "size" element is a select box, you can't use element.value to get the selected value from a select box.
You need to use selectedIndex:

document.getElementById("size").options[document.getElementById("size").selectedIndex].value

Also, you might wanna add an id parameter to size2, just to be on the safe side.

- Maddog
0
 
stroudtxAuthor Commented:

I tried it and it did not work?

how is it supposed to look?  this is what I tried

document.getElementById('size2').value = document.getElementById("size").options[document.getElementById("size").selectedIndex].value
0
 
_Maddog_Commented:
Hmm... here's a sample code:

<HTML>
<BODY>
<script language="JavaScript">
function doIt()
{
document.getElementById("size2").value = document.getElementById("size").options[document.getElementById("size").selectedIndex].value;
alert(document.getElementById("size2").value);
}
</script>

<select id=size>
<option value=maddog>Maddog</option>
<option value=stroudtx>stroudtx</option>
</select>

<input type=text name=size2>

<input type=button onclick="doIt()" value=Click>
</BODY>
</HTML>
0
 
mvan01Commented:
Hi stroudtx,

You need to specify an id= on any element which you will access via .getElementById() .  The name= field is not the same as the id= field.  Try it thus:

<HTML>
<BODY>
<script language="JavaScript">
function doIt() {
   document.getElementById("size2").value = document.getElementById("size").options[document.getElementById("size").selectedIndex].value;
}
</script>

<select id=size>
<option value=mvan>MVan</option>
<option value=maddog>Maddog</option>
<option value=stroudtx>stroudtx</option>
</select>

<input type=text name=size2 id=size2>

<input type=button onclick="doIt()" value=Click>
</BODY>
</HTML>


:-)

Be careful of older browsers, as this points out:
http://developer.apple.com/internet/safari/faq.html#anchor3

Peace and joy.  mvan
0
 
_Maddog_Commented:
mvan01, I've already pointed that out :-)

"Also, you might wanna add an id parameter to size2, just to be on the safe side."
0
 
mvan01Commented:
@Maddog,

Of course you already pointed that out.  I read your comment in http:21841031#16624477 .  But your latest example didn't include id=size2, and therefore will not work in all browsers.  And between your suggestion and that example code, stroudx asked "how is it supposed to look?"

I just showed how it is supposed to look.  ;-)

Peace and joy.  mvan
0
 
mvan01Commented:
@Maddog,

oops ... that's http:Q_21841031.html#16624477

Peace and joy.  mvan
0
 
_Maddog_Commented:
Oh, I can't believe I did that :-(
sorry mvan, you're right.
It was silly of me to provide instructions and not follow them myself in a subsequent post.
0
 
stroudtxAuthor Commented:
ok - working so far, but still one field doesn't work.

It is a text field so I left:

document.getElementById('persregistry').value = document.getElementById('Presonalize').value;

and the field it self is ID'd as

<input name="Presonalize" type="text" id="Presonalize" size="50" maxlength="50" />

and the hidden value in the other form is

<input type="hidden" name="persregistry" id = "persregistry" >

0
 
stroudtxAuthor Commented:
well, not so good news.

It still not working. I had added an if form <> "" then set value to 0 and that what it is doing every time.  I thought it was working becuase the error wasn't there.  It's just cDbl'ing a 0 instead of NULL now :(
0
 
stroudtxAuthor Commented:
<script language="JavaScript">
function doIt() {
   document.getElementById('size2').value = document.getElementById('size').options[document.getElementById('size').selectedIndex].value;
   document.getElementById('opt1').value = document.getElementById('Option1').options[document.getElementById('Option1').selectedIndex].value;
      document.getElementById('opt2').value = document.getElementById('Option2').options[document.getElementById('Option2').selectedIndex].value;
      document.getElementById('opt3').value = document.getElementById('Option3').options[document.getElementById('Option3').selectedIndex].value;
      document.getElementById('persregistry').value = document.getElementById('Presonalize').value;
}
</script>

Also, this is my doIt statement. I checked all of the id's and they all match.

Mike
0
 
stroudtxAuthor Commented:
I might have a clue....

The size field is text so I want to pull the visable drop down selected.

The options 1, 2, 3 and the values that are associated with the visable text.  Thus, I need it to pull that value instead of the text value.  It's a number.

Does that make sense?
0
 
stroudtxAuthor Commented:
More weird behavior

When I add an item to the registry that has an option text of "7 Letters" and a value of 120 it works fine on the pc.  The personalization field does not still.

When I add an item to the registry that has an option text of "Add Crib Sheet (+65) and a value of 65 it doesn't now work.  Could the (+65) be messing it up? It's just a text field.

I use sucessfully,

function x(sel) {
    document.getElementById("hiddenField").value = sel.options[sel.selectedIndex].text;
      document.getElementById("opt1registry").value = sel.options[sel.selectedIndex].text;
}

to get the text label.

Really appreciate all of the help so far. We must be close.
0
 
stroudtxAuthor Commented:
I think it's this simple

selected text returns the drop down label selected and not the value associated with it.

for that?
0
 
stroudtxAuthor Commented:
fixed...
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 10
  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now