jayh99
asked on
Setting hidden value
It seems like it should work to me, but I am not having much luck with it. I get the 2 message boxes with the "FullAddress" & "point" but for some reason it is not setting my hidden form value geoAddress = point. Thanks in advance for the help.
<script type="text/javascript">
function showAddress(address) {
geocoder = new GClientGeocoder();
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
//alert(address + " not found");
} else {
alert(point);
document.Person.geoAddress .value=poi nt;
}
}
);
}
}
</script>
<script>
function validate(){
var FullAddress = document.Person.Address.va lue + ' ' + document.Person.City.value + ', ' + document.Person.State.valu e + ' ' + document.Person.Zip.value;
alert(FullAddress);
showAddress(FullAddress);
}
</script>
<script type="text/javascript">
function showAddress(address) {
geocoder = new GClientGeocoder();
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
//alert(address + " not found");
} else {
alert(point);
document.Person.geoAddress
}
}
);
}
}
</script>
<script>
function validate(){
var FullAddress = document.Person.Address.va
alert(FullAddress);
showAddress(FullAddress);
}
</script>
What's document.Person? It looks quite odd. Can you post a little of the markup so we can see exactly what it is you're trying to access, i.e. something of the actual HTML.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Person is my form's name. You are completing the person's identification on the page. I'll post the code when I get a chance to pull the page off my other computer.
ASKER
<!--#Include File="dbConn.asp"-->
<%
If Session("Username") = "" Then
Response.Redirect "Login_Form.asp"
End If
If Not Request("DLNo") = "" Then
DLNo = Replace(Request("DLNo"),"- ","")
strSQL = "SELECT * FROM Buyer WHERE DL = '" & DLNo & "' ORDER BY strTimestamp DESC;"
'Open the recordset with the SQL query
rsNewInfo.Open strSQL, adoCon
If not rsNewInfo.EOF = True Then
Name = rsNewInfo.Fields("Name")
Address = rsNewInfo.Fields("Address" )
City = rsNewInfo.Fields("City")
State = rsNewInfo.Fields("State")
Zip = rsNewInfo.Fields("Zip")
DOB = rsNewInfo.Fields("DOB")
End If
Else
Response.Redirect("Index.a sp?msg=1")
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Axinym Corporation -- Sudafed Tracking... Take back your community</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="Axinym Corporation, Sudafed Purchase Tracking" />
<link rel="stylesheet" href="Sudafed.css" type="text/css" media="screen,projection" />
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAl-3ZboM2_f9yjZTXTsh1KxRQWaFEKaw_MRNWqEuurOrBPxI3DRSbXFalMHAENayoM90eXcfs7FbwRQ"
type="text/javascript"></s cript>
<script type="text/javascript">
function showAddress(address) {
geocoder = new GClientGeocoder();
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
//alert(address + " not found");
} else {
document.Person.geoAddress .value=poi nt;
}
}
);
}
}
</script>
<script>
function validate(){
var msg = 'You must complete the following fields:';
var FullAddress = document.Person.Address.va lue + ' ' + document.Person.City.value + ', ' + document.Person.State.valu e + ' ' + document.Person.Zip.value;
showAddress(FullAddress);
//Drivers License Number
if(document.Person.DLNo.va lue.length == 0){
msg=msg.concat(" \n ID Number");
}
//Name
if(document.Person.Name.va lue.length == 0){
msg=msg.concat(" \n Name");
}
//Address
if(document.Person.Address .value.len gth == 0){
msg=msg.concat(" \n Address");
}
//City
if(document.Person.City.va lue.length == 0){
msg=msg.concat(" \n City");
}
//State
if(document.Person.State.v alue.lengt h == 0){
msg=msg.concat(" \n State");
}
//Zip
if(document.Person.Zip.val ue.length == 0){
msg=msg.concat(" \n Zip");
}
//Date of Birth
if(document.Person.DOB.val ue.length == 0){
msg=msg.concat(" \n Date of Birth");
}
//Quantity
if(document.Person.Quantit y.value.le ngth == 0){
msg=msg.concat(" \n Purchase Quantity");
}
//Strength
if(document.Person.Strengt h.value.le ngth == 0){
msg=msg.concat(" \n Purchase Strength");
}
//Initials
if(document.Person.Initial s.value.le ngth == 0){
msg=msg.concat(" \n Seller Initials");
}
if(msg.length > 39) {
alert(msg);
return false;
}
var purchasetotal = document.Person.Strength.v alue * document.Person.Quantity.v alue;
if (purchasetotal > 3000) {
alert('Buyer cannot purchase more than 3000 mg at one time! \n \n Amount Requested: ' + purchasetotal + ' mg');
return false;
}
var weeklytotal = parseFloat(purchasetotal) + parseFloat(document.Person .Total.val ue)
if (parseFloat(purchasetotal) + parseFloat(document.Person .Total.val ue) > 3000){
alert('This purchase would exceed the 3000 mg per week total for this buyer! \n \n Weekly Total Requested: ' + weeklytotal + ' mg');
return false;
}
}
</script>
</head>
<body onunload="GUnload()">
<div id="container" >
<div id="header">
</div>
<div id="navigation">
<ul>
<li class="selected"><a href="Index.asp">Home</a>< /li>
<li><a href="ReportMenu.asp">Repo rting</a>< /li>
</ul>
</div>
<div id="content">
<div align="center"><h2><%=Sess ion("Pharm acyName")% ></h2></di v>
<form name="Person" action="Complete.asp" onSubmit="return validate();">
<h2>Complete the Buyer's Information:</h2>
<table width="487" height="254" border="0" background="images/smDL.pn g">
<tr>
<td>
<br/>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="25%"><p> </p>
<p> </p>
<p><img src="images/Person.jpg" alt="" hspace="20" /></p>
</td>
<td width="75%">
<br/><br/><br/>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><b>ID #:</b></td>
<td><input name="DLNo" id="DLNo" type="text" size="23" class="text" value="<%=Request("DLNo")% >" />
xxxx-xx-xxxx</td>
</tr>
<tr>
<td width="130"><b>Name:</b></ td>
<td><input name="Name" type="text" size="32" class="text" value="<%=Name%>" /></td>
</tr>
<tr>
<td width="130"><b>Address:</b ></td>
<td><input name="Address" type="text" size="37" class="text" value="<%=Address%>" /></td>
</tr>
<tr>
<td><b>City:</b></td>
<td><input name="City" id="City" type="text" size="30" class="text" value="<%=City%>" /></td>
</tr>
<tr>
<td><b>State:</b> </td>
<td><input name="State" id="State" type="text" size="8" class="text" value="<%=State%>" />
<b >Zip:</b>
<input name="Zip" type="text" size="15" class="text" value="<%=Zip%>" /></td>
</tr>
<tr>
<td width="130"><b>Date of Birth:</b></td>
<td><input name="DOB" type="text" size="15" class="text" value="<%=DOB%>" />
xx/xx/xxxx</td>
</tr>
</table></td>
</tr>
</table> </td>
</tr>
</table>
<a href="Index.asp" target="_top">Cancel</a>
<p> </p>
<p>
<div class="box">
<h3>Review Buyer History</h3>
<%
If not rsNewInfo.EOF = True Then
rsNewInfo.MoveFirst
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="2" colspan="4"><img src="images/bar.png" width="100%" height="1"></td>
</tr>
<tr>
<td><b>Purchase Date</b></td>
<td align="center"><b>Quantity </b></td>
<td align="center"><b>Strength </b></td>
<td align="center"><b>Amount</ b></td>
</tr>
<%
Do
If datediff("d", rsNewInfo.Fields("strDate" ),Now) <= 7 then
weekTotal = weekTotal + clng(replace(rsNewInfo.Fie lds("Amoun t"), " mg",""))
If weekTotal > 2900 then
flag = 1
End If
bg = "#FFBBBB"
Else
bg = "#FFFFFF"
End If
%>
<tr bgcolor="<%=bg%>">
<td><%=rsNewInfo.Fields("s trTimestam p")%></td>
<td align="center"><%=rsNewInf o.Fields(" Quantity") %></td>
<td align="center"><%=rsNewInf o.Fields(" Strength") %></td>
<td align="center"><%=rsNewInf o.Fields(" Amount")%> </td>
</tr>
<%
rsNewInfo.MoveNext
Loop Until rsNewInfo.EOF = True
If weekTotal = "" then weekTotal = 0
%>
<tr>
<td height="2" colspan="4"><img src="images/bar.png" width="100%" height="1"></td>
</tr>
<tr>
<td colspan="4">
<%
If weekTotal < 1500 then
strColor = "Green"
End If
If weekTotal > 2000 then
strColor = "#FF9900"
End If
If weekTotal > 2999 then
strColor = "Red"
End If
%>
<b>7 Day Total: <font color="<%=strColor%>"><%=w eekTotal%> mg</font></b>
</td>
</tr>
</table>
<%
Else
%>
This buyer has no previous purchases.
<%
End If
%>
</div>
<%
If not flag = 1 Then
%>
<br/>
<h3>Purchase Information</h3>
<table width="450">
<tr>
<td>Pack Quantity: <input name="Quantity" type="text" size="15" class="text" value="<%=Request("Quantit y")%>" /> tablets</td>
</tr>
<tr>
<td>Strength: <input name="Strength" type="text" size="15" class="text" value="<%=Request("Strengt h")%>" /> mg
</td>
</tr>
<tr>
<td>Seller Initials: <input name="Initials" type="text" class="text" value="" size="5" maxlength="3" /></td>
</tr>
</table>
<input type="hidden" name="Search" value="1" />
<br/>
<%
If Request("msg") = 3000 Then
%>
<div align="center">
<span class="important">A buyer is not allowed to purchase more than 3000 mg of Sudafed at a one time.</span>
</div>
<%
End If
%>
<input type="hidden" name="Total" value="<%=weektotal%>" />
<input type="hidden" name="geoAddress" id="geoAddress" value="">
<input type="submit" name="Submit" class="searchbutton" value=" Confirm Purchase "/>
</p>
<%
Else
%>
<br/>
<span class="important">This buyer has purchased the weekly 3000 mg limit of Sudafed.</span>
<%
End If
%>
<br/>
<br/>
</form>
</div>
<div id="footer">
<p> </p>
</div>
</div>
</body>
</html>
<%
rsNewInfo.Close
adoCon.Close
%>
<%
If Session("Username") = "" Then
Response.Redirect "Login_Form.asp"
End If
If Not Request("DLNo") = "" Then
DLNo = Replace(Request("DLNo"),"-
strSQL = "SELECT * FROM Buyer WHERE DL = '" & DLNo & "' ORDER BY strTimestamp DESC;"
'Open the recordset with the SQL query
rsNewInfo.Open strSQL, adoCon
If not rsNewInfo.EOF = True Then
Name = rsNewInfo.Fields("Name")
Address = rsNewInfo.Fields("Address"
City = rsNewInfo.Fields("City")
State = rsNewInfo.Fields("State")
Zip = rsNewInfo.Fields("Zip")
DOB = rsNewInfo.Fields("DOB")
End If
Else
Response.Redirect("Index.a
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Axinym Corporation -- Sudafed Tracking... Take back your community</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="Axinym Corporation, Sudafed Purchase Tracking" />
<link rel="stylesheet" href="Sudafed.css" type="text/css" media="screen,projection" />
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAl-3ZboM2_f9yjZTXTsh1KxRQWaFEKaw_MRNWqEuurOrBPxI3DRSbXFalMHAENayoM90eXcfs7FbwRQ"
type="text/javascript"></s
<script type="text/javascript">
function showAddress(address) {
geocoder = new GClientGeocoder();
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
//alert(address + " not found");
} else {
document.Person.geoAddress
}
}
);
}
}
</script>
<script>
function validate(){
var msg = 'You must complete the following fields:';
var FullAddress = document.Person.Address.va
showAddress(FullAddress);
//Drivers License Number
if(document.Person.DLNo.va
msg=msg.concat(" \n ID Number");
}
//Name
if(document.Person.Name.va
msg=msg.concat(" \n Name");
}
//Address
if(document.Person.Address
msg=msg.concat(" \n Address");
}
//City
if(document.Person.City.va
msg=msg.concat(" \n City");
}
//State
if(document.Person.State.v
msg=msg.concat(" \n State");
}
//Zip
if(document.Person.Zip.val
msg=msg.concat(" \n Zip");
}
//Date of Birth
if(document.Person.DOB.val
msg=msg.concat(" \n Date of Birth");
}
//Quantity
if(document.Person.Quantit
msg=msg.concat(" \n Purchase Quantity");
}
//Strength
if(document.Person.Strengt
msg=msg.concat(" \n Purchase Strength");
}
//Initials
if(document.Person.Initial
msg=msg.concat(" \n Seller Initials");
}
if(msg.length > 39) {
alert(msg);
return false;
}
var purchasetotal = document.Person.Strength.v
if (purchasetotal > 3000) {
alert('Buyer cannot purchase more than 3000 mg at one time! \n \n Amount Requested: ' + purchasetotal + ' mg');
return false;
}
var weeklytotal = parseFloat(purchasetotal) + parseFloat(document.Person
if (parseFloat(purchasetotal)
alert('This purchase would exceed the 3000 mg per week total for this buyer! \n \n Weekly Total Requested: ' + weeklytotal + ' mg');
return false;
}
}
</script>
</head>
<body onunload="GUnload()">
<div id="container" >
<div id="header">
</div>
<div id="navigation">
<ul>
<li class="selected"><a href="Index.asp">Home</a><
<li><a href="ReportMenu.asp">Repo
</ul>
</div>
<div id="content">
<div align="center"><h2><%=Sess
<form name="Person" action="Complete.asp" onSubmit="return validate();">
<h2>Complete the Buyer's Information:</h2>
<table width="487" height="254" border="0" background="images/smDL.pn
<tr>
<td>
<br/>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="25%"><p> </p>
<p> </p>
<p><img src="images/Person.jpg" alt="" hspace="20" /></p>
</td>
<td width="75%">
<br/><br/><br/>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><b>ID #:</b></td>
<td><input name="DLNo" id="DLNo" type="text" size="23" class="text" value="<%=Request("DLNo")%
xxxx-xx-xxxx</td>
</tr>
<tr>
<td width="130"><b>Name:</b></
<td><input name="Name" type="text" size="32" class="text" value="<%=Name%>" /></td>
</tr>
<tr>
<td width="130"><b>Address:</b
<td><input name="Address" type="text" size="37" class="text" value="<%=Address%>" /></td>
</tr>
<tr>
<td><b>City:</b></td>
<td><input name="City" id="City" type="text" size="30" class="text" value="<%=City%>" /></td>
</tr>
<tr>
<td><b>State:</b> </td>
<td><input name="State" id="State" type="text" size="8" class="text" value="<%=State%>" />
<b
<input name="Zip" type="text" size="15" class="text" value="<%=Zip%>" /></td>
</tr>
<tr>
<td width="130"><b>Date of Birth:</b></td>
<td><input name="DOB" type="text" size="15" class="text" value="<%=DOB%>" />
xx/xx/xxxx</td>
</tr>
</table></td>
</tr>
</table> </td>
</tr>
</table>
<a href="Index.asp" target="_top">Cancel</a>
<p> </p>
<p>
<div class="box">
<h3>Review Buyer History</h3>
<%
If not rsNewInfo.EOF = True Then
rsNewInfo.MoveFirst
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="2" colspan="4"><img src="images/bar.png" width="100%" height="1"></td>
</tr>
<tr>
<td><b>Purchase Date</b></td>
<td align="center"><b>Quantity
<td align="center"><b>Strength
<td align="center"><b>Amount</
</tr>
<%
Do
If datediff("d", rsNewInfo.Fields("strDate"
weekTotal = weekTotal + clng(replace(rsNewInfo.Fie
If weekTotal > 2900 then
flag = 1
End If
bg = "#FFBBBB"
Else
bg = "#FFFFFF"
End If
%>
<tr bgcolor="<%=bg%>">
<td><%=rsNewInfo.Fields("s
<td align="center"><%=rsNewInf
<td align="center"><%=rsNewInf
<td align="center"><%=rsNewInf
</tr>
<%
rsNewInfo.MoveNext
Loop Until rsNewInfo.EOF = True
If weekTotal = "" then weekTotal = 0
%>
<tr>
<td height="2" colspan="4"><img src="images/bar.png" width="100%" height="1"></td>
</tr>
<tr>
<td colspan="4">
<%
If weekTotal < 1500 then
strColor = "Green"
End If
If weekTotal > 2000 then
strColor = "#FF9900"
End If
If weekTotal > 2999 then
strColor = "Red"
End If
%>
<b>7 Day Total: <font color="<%=strColor%>"><%=w
</td>
</tr>
</table>
<%
Else
%>
This buyer has no previous purchases.
<%
End If
%>
</div>
<%
If not flag = 1 Then
%>
<br/>
<h3>Purchase Information</h3>
<table width="450">
<tr>
<td>Pack Quantity: <input name="Quantity" type="text" size="15" class="text" value="<%=Request("Quantit
</tr>
<tr>
<td>Strength: <input name="Strength" type="text" size="15" class="text" value="<%=Request("Strengt
</td>
</tr>
<tr>
<td>Seller Initials: <input name="Initials" type="text" class="text" value="" size="5" maxlength="3" /></td>
</tr>
</table>
<input type="hidden" name="Search" value="1" />
<br/>
<%
If Request("msg") = 3000 Then
%>
<div align="center">
<span class="important">A buyer is not allowed to purchase more than 3000 mg of Sudafed at a one time.</span>
</div>
<%
End If
%>
<input type="hidden" name="Total" value="<%=weektotal%>" />
<input type="hidden" name="geoAddress" id="geoAddress" value="">
<input type="submit" name="Submit" class="searchbutton" value=" Confirm Purchase "/>
</p>
<%
Else
%>
<br/>
<span class="important">This buyer has purchased the weekly 3000 mg limit of Sudafed.</span>
<%
End If
%>
<br/>
<br/>
</form>
</div>
<div id="footer">
<p> </p>
</div>
</div>
</body>
</html>
<%
rsNewInfo.Close
adoCon.Close
%>