Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Posting to itself and linking to anchor tag

Status
Not open for further replies.

BG12424

Programmer
Jun 4, 2002
717
US
I have an asp page with a grid of information. I am updating this page with information. After I update my page I would like to anchor my page down to the last updated id in the table. How can I do this? Thanks (see below for example)

<% below is pseudo logic

if page is posted then

get ids of checkboxes to perform updates on.

for each id in list of ids
perform update on each line item.
next
id = lastid

end if

%>

start html table
<a name=&quot;1&quot;>
row 1
<a name=&quot;2&quot;>
row 2
<a name=&quot;3&quot;>
row 3
end html table regards,
Brian
 
I haven't tried this but I would think that if you put the anchor tag's name value in the action of the asp page that you are submitting to it should work.

<form action=&quot;x.asp?#1&quot;>

or

<form action=&quot;x.asp?#2&quot;>
 
This page name: OnlineNorm.asp

The only problem with this is that I don't know the id until I post the page to itself, so I can't do the OnlineNorm.asp#2 (if the last id is 2 that I updated). How can I dynamically change the form action using asp in order to replicate your idea? Thanks (see below)


<form action=OnlineNorm.asp>
checkbox value=1 - row of data
checkbox value=2 - row of data
checkbox value=3 - row of data
submit button
</form> regards,
Brian
 
Give the link a standard name like &quot;newonehere&quot; so you will always know what the name is when you are writing your first form tag. When you loop through your records to write them (after inserting the new record) look for a match on the new record and insert and anchor tag. Since you have only one new record, you only need a static name for the anchor tag that can always be the same.

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
No more vacation for me :(

FAQ FAQ20-2863
= new Forums.Posting.General.GettingAnswers()
 
I don't understand what you are telling me Tarwn. To make sure we are on the same page, I am posting my actual code below. Thanks

This is what I have so far. I was trying to do it in ASP or Javascript, but neither is working for me currently. I hope you have a better idea as to what I am trying to accomplish now.

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<html>
<head>
<script LANGUAGE=&quot;JavaScript&quot;>

function validate()
{
var controlIndex;
var element;
var epsid;
var numberOfControls = document.theForm.length;
for (controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
{
element = document.theForm[controlIndex];
if (element.type == &quot;checkbox&quot;)
{
if (element.checked == true)
{
epsid = element.value.split(&quot;~&quot;);
}
}
}
document.theForm.action=&quot;OnlineNorm.asp#&quot; + epsid[1];
document.theForm.submit();
}
</script>
<title>RHIMR - Online Normalization Process</title>
<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;rhimr.css&quot;>
<%
Server.ScriptTimeout = 7200
Response.AddHeader &quot;Pragma&quot;, &quot;No-Cache&quot;

dim formValue
formValue = Request.Form(&quot;SUBMITTYPE&quot;)

function GetIdValues(frmValue,fldval,epsid)

dim frmValList
frmValList = split(frmValue,&quot;~&quot;)
fldval = frmValList(0)
epsid = frmValList(1)

end function

if Request.Form(&quot;CKBOX&quot;) <> &quot;&quot; then
dim list, j, fldval, epsid, vname, recs_updated, recs, retval, last_epsid
recs_updated = 0
list = split(Request.Form(&quot;CKBOX&quot;),&quot;,&quot;)
for j = lbound(list) to ubound(list)
fldval = &quot;&quot; : epsid = &quot;&quot; : retval = 0 : recs = 0
GetIdValues list(j),fldval,epsid
vname = Request.Form(&quot;TXT&quot; & trim(epsid))
BI_Upd_New_Vendor_Name_EPS_ID trim(vname),trim(epsid),retval, recs
if retval > 0 then
Response.Write(&quot;ERROR: &quot; & retval)
end if
recs_updated = recs_updated + 1
next
last_epsid = trim(epsid)
formValue=Request.Form(&quot;pageType&quot;)
end if

%>
</head>
<a NAME=&quot;TOP&quot;></a>
<body topmargin=&quot;0&quot; leftmargin=&quot;0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; class=&quot;bodyText&quot;>
<table BORDER=&quot;0&quot; WIDTH=&quot;750&quot; HEIGHT=&quot;15&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr bgcolor=&quot;#990000&quot;><td colspan=&quot;3&quot;> </td></tr>
<tr>
<td width=&quot;210&quot;><img src=&quot;img/RHMR_logo_new.gif&quot; width=&quot;210&quot; height=&quot;78&quot; border=&quot;0&quot;></td>
<td align=&quot;right&quot;><img src=&quot;img/man_phone.jpg&quot; width=&quot;220&quot; height=&quot;95&quot; border=&quot;0&quot;><img src=&quot;img/columns.jpg&quot; width=&quot;306&quot; height=&quot;95&quot; border=&quot;0&quot;></td>
</tr>
</table>
<p>
<form NAME=&quot;theForm&quot; METHOD=&quot;POST&quot; ACTION=&quot;OnlineNorm.asp&quot; onSubmit=&quot;validate();&quot;>
<input type=&quot;hidden&quot; name=&quot;pageType&quot; value=&quot;<%=formValue%>&quot;>
<table BORDER=&quot;0&quot; CELLSPACING=&quot;0&quot; CELLPADDING=&quot;5&quot; WIDTH=&quot;750&quot;>
<tr>
<td CLASS=&quot;bodyText&quot; ALIGN=&quot;MIDDLE&quot; COLSPAN=&quot;100%&quot;><font SIZE=&quot;4&quot;><b>Online Normalization</b></font></td>
</tr>
<%
if recs_updated > 0 then
Response.Write(&quot;<TR><TD class=bodyText align=middle colspan=100%&quot; & &quot;><font size=2 color=red><b>&quot; & recs_updated & &quot; records updated</b></font></td></tr>&quot;)
end if
%>
<tr>
<td ALIGN=&quot;MIDDLE&quot;>
<table WIDTH=&quot;740&quot; BORDER=&quot;0&quot; BGCOLOR=&quot;#FFFFFF&quot; CELLPADDING=&quot;2&quot; CELLSPACING=&quot;1&quot;>
<%
dim i,buildCOLS,prev,curr,desc

select case proc
case &quot;BI_Addr1_Norm_X&quot;
desc = &quot;(DUPLICATES - CHECK &quot; & CHR(34) & &quot;X&quot; & CHR(34) & &quot; ADDR1)&quot;
case &quot;BI_Addr1_Norm_No_X&quot;
desc = &quot;(NO DUPLICATES - NO CHECK &quot; & CHR(34) & &quot;X&quot; & CHR(34) & &quot; ADDR1)&quot;
case &quot;BI_Addr1_Norm_All&quot;
desc = &quot;(ALL RECORDS - BOTH CHECK &quot; & CHR(34) & &quot;X&quot; & CHR(34) & &quot; AND UNCHECK ADDR1)&quot;
end select

'build the table header row
buildCOLS = &quot;<TR><td colspan=9 align=middle class=bodyText><b><font size=3>Remittance Address 1 Normalization Table<br><center><font size=2>&quot; & desc & &quot;</font></center></font></b></td></TR>&quot;
buildCOLS = buildCOLS & makeTH(&quot;UPDATE&quot;) & endline
buildCOLS = buildCOLS & makeTH(&quot;Old Name&quot;) & endline
buildCOLS = buildCOLS & makeTH(&quot;New Name&quot;) & endline
buildCOLS = buildCOLS & makeTH(&quot;VId&quot;) & endline
buildCOLS = buildCOLS & makeTH(&quot;FedId&quot;) & endline
buildCOLS = buildCOLS & makeTH(&quot;Old_Addr1&quot;) & endline
buildCOLS = buildCOLS & makeTH(&quot;Addr1&quot;) & endline
buildCOLS = buildCOLS & makeTH(&quot;City&quot;) & endline
buildCOLS = buildCOLS & makeTH(&quot;State&quot;) & endline
buildCOLS = buildCOLS & makeTH(&quot;Zip&quot;) & endline
Response.Write(makeTR(buildCOLS,0,1) & endline)
buildCOLS = &quot;&quot; 'clear out header values

i=0
do while not rs.EOF
if i mod 2 = 0 then
prev = rs(&quot;NEW_REMITTANCE_ADDRESS_1&quot;)
else
curr = rs(&quot;NEW_REMITTANCE_ADDRESS_1&quot;)
end if
buildCOLS = buildCOLS & makeTD(&quot;<INPUT TYPE=CHECKBOX NAME=CKBOX VALUE=&quot; & qt & rs(&quot;NEW_REMITTANCE_ADDRESS_1&quot;) & &quot;~&quot; & rs(&quot;EPS_ID&quot;) & qt & &quot;>&quot;,&quot;bodyText&quot;,&quot;CENTER&quot;) & endline
buildCOLS = buildCOLS & makeTD(rs(&quot;VENDOR_NAME&quot;),&quot;bodyText&quot;,&quot;LEFT&quot;) & endline
buildCOLS = buildCOLS & makeTD(&quot;<INPUT TYPE=TEXT NAME=TXT&quot; & rs(&quot;EPS_ID&quot;) & &quot; VALUE=&quot; & qt & rs(&quot;NEW_VENDOR_NAME&quot;) & qt & &quot;>&quot;,&quot;bodyText&quot;,&quot;LEFT&quot;) & endline
buildCOLS = buildCOLS & makeTD(rs(&quot;NEW_FEDERAL_ID&quot;),&quot;bodyText&quot;,&quot;CENTER&quot;) & endline
buildCOLS = buildCOLS & makeTD(rs(&quot;REMITTANCE_ADDRESS_1&quot;),&quot;bodyText&quot;,&quot;CENTER&quot;) & endline
buildCOLS = buildCOLS & makeTD(rs(&quot;NEW_REMITTANCE_ADDRESS_1&quot;),&quot;bodyText&quot;,&quot;CENTER&quot;) & endline
buildCOLS = buildCOLS & makeTD(rs(&quot;REMITTANCE_CITY&quot;),&quot;bodyText&quot;,&quot;CENTER&quot;) & endline
buildCOLS = buildCOLS & makeTD(rs(&quot;REMITTANCE_STATE&quot;),&quot;bodyText&quot;,&quot;CENTER&quot;) & endline
buildCOLS = buildCOLS & makeTD(rs(&quot;NEW_REMITTANCE_ZIP&quot;),&quot;bodyText&quot;,&quot;CENTER&quot;) & endline
Response.Write(&quot;<a name=&quot; & rs(&quot;EPS_ID&quot;) & &quot;>&quot; & endline & makeTR(buildCOLS,prev,curr) & endline)
buildCOLS = &quot;&quot; 'clear out column values and start over
i=i+1
FlushResponse(i)
rs.movenext
loop
%>
</table>
</td>
</tr>
<tr>
<td WIDTH=&quot;100%&quot; ALIGN=&quot;MIDDLE&quot;><input NAME=&quot;SUBMITTYPE&quot; TYPE=&quot;SUBMIT&quot; VALUE=&quot;Update Vendor Name&quot;></td>
</tr>
<tr>
<td WIDTH=&quot;100%&quot; ALIGN=&quot;RIGHT&quot; COLSPAN=&quot;100%&quot;><a href=&quot;#TOP&quot; class=&quot;norm&quot;><img SRC=&quot;img/top.gif&quot; border=&quot;0&quot;></a> <a href=&quot;#TOP&quot; class=&quot;norm&quot;>Back to Top</a></td>
</tr>
</table>
</form>
</body>
</html> regards,
Brian
 
I got it to work. I was incorrectly writing the <a name=value></a> tag

do while not rs.EOF
if i mod 2 = 0 then
prev = rs(&quot;NEW_REMITTANCE_ADDRESS_1&quot;)
else
curr = rs(&quot;NEW_REMITTANCE_ADDRESS_1&quot;)
end if
buildCOLS = buildCOLS & makeTD(&quot;<a name=&quot; & rs(&quot;EPS_ID&quot;) & &quot;><INPUT TYPE=CHECKBOX NAME=CKBOX VALUE=&quot; & qt & rs(&quot;NEW_REMITTANCE_ADDRESS_1&quot;) & &quot;~&quot; & rs(&quot;EPS_ID&quot;) & qt & &quot;></a>&quot;,&quot;bodyText&quot;,&quot;CENTER&quot;) & endline
buildCOLS = buildCOLS & makeTD(rs(&quot;VENDOR_NAME&quot;),&quot;bodyText&quot;,&quot;LEFT&quot;) & endline
buildCOLS = buildCOLS & makeTD(&quot;<INPUT TYPE=TEXT NAME=TXT&quot; & rs(&quot;EPS_ID&quot;) & &quot; VALUE=&quot; & qt & rs(&quot;NEW_VENDOR_NAME&quot;) & qt & &quot;>&quot;,&quot;bodyText&quot;,&quot;LEFT&quot;) & endline
buildCOLS = buildCOLS & makeTD(rs(&quot;NEW_FEDERAL_ID&quot;),&quot;bodyText&quot;,&quot;CENTER&quot;) & endline
buildCOLS = buildCOLS & makeTD(rs(&quot;REMITTANCE_ADDRESS_1&quot;),&quot;bodyText&quot;,&quot;CENTER&quot;) & endline
buildCOLS = buildCOLS & makeTD(rs(&quot;NEW_REMITTANCE_ADDRESS_1&quot;),&quot;bodyText&quot;,&quot;CENTER&quot;) & endline
buildCOLS = buildCOLS & makeTD(rs(&quot;REMITTANCE_CITY&quot;),&quot;bodyText&quot;,&quot;CENTER&quot;) & endline
buildCOLS = buildCOLS & makeTD(rs(&quot;REMITTANCE_STATE&quot;),&quot;bodyText&quot;,&quot;CENTER&quot;) & endline
buildCOLS = buildCOLS & makeTD(rs(&quot;NEW_REMITTANCE_ZIP&quot;),&quot;bodyText&quot;,&quot;CENTER&quot;) & endline
Response.Write(makeTR(buildCOLS,prev,curr) & endline)
buildCOLS = &quot;&quot; 'clear out column values and start over
i=i+1
FlushResponse(i)
rs.movenext
loop regards,
Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top