DB update form confirmation page (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


ttjager -> DB update form confirmation page (10/2/2005 0:55:19)

I have an FP form that posts to a database. Works fine.

I would like the confirmation page to return the record's ID field so it can be loaded into a link that would allow the visitor to view the record they just updated.

Something like:

<a href="details.asp?ID=<% If Not IsEmpty(fp_rs) And Not(fp_rs Is Nothing) Then Response.Write CStr(fp_rs("ID")) %>">

I figure out how to get the ID field loaded into a link. I can return the ID using an FP Confirmation Field, but that cannot be dynamically loaded into a hyperlink.

Any ideas?




Spooky -> RE: DB update form confirmation page (10/2/2005 20:44:11)

The FP confirmation field has to be on an html page though? Or are you using an asp confirmation page (not the FP version)




ttjager -> RE: DB update form confirmation page (10/3/2005 1:54:15)

I am currently using an customized FP ASP confirmation page. It will display the confirmation field just fine. But I can't figure out how to load that confirmation field into a query string -

something like:

<a href="details.asp?ID=ConfirmationField"> (where ConfirmationField = a record ID)

But that doesn't work. I can actually load the confirmation field web bot into the link, but it doesn't work through the browser.

Here's the task in a nutshell. The record ID is currently passed via a link to the form. When the form is submitted, it is passed via a hidden field to the database along with the additional information contained on the form. This all works just fine. Now I need to make some sort of confirmation page that will get that record ID loaded into a hyperlink, so the person who just added that record can see it.

Todd





ttjager -> RE: DB update form confirmation page (10/10/2005 16:24:15)

OK, I can only assume you simply can’t do this operation using an FP form to post to a database, or someone would have answered this.

If that’s the case, perhaps I shouldn’t be using an FP form here. Perhaps I should be using an “Insert” asp command. I must admit, I’m not too familiar with this and this is not the form to teach me from scratch. Can someone suggest a link or two or three with some tutorials on the subject. The only OutFront tutorials I could find that were close to this subject were for Update commands.

Thanks,

Todd




Spooky -> RE: DB update form confirmation page (10/10/2005 16:30:40)

Check this out : link to word doc




Spooky -> RE: DB update form confirmation page (10/11/2005 13:11:53)

You are currently doing just that with an asp page though?




ttjager -> RE: DB update form confirmation page (10/11/2005 13:58:33)


quote:

ORIGINAL: Spooky

You are currently doing just that with an asp page though?


Spooky, I'm not sure I understand your question - the confirmation page is a simple asp page with a couple FP confirmation fields. What I need is to generate the link though.

Todd




BeTheBall -> RE: DB update form confirmation page (10/11/2005 16:31:25)

Is the insert sql on the confirmation page itself? If so, then the Request.Form object is still available to you and you can form your URL like this:


http://www.alea1.org/memorial/details_thoughts.asp?ID=<%=Request.Form("ID")%>




ttjager -> RE: DB update form confirmation page (10/11/2005 17:44:07)

Duane:

I'm using an FP form to post to the DB. As this thread continues, I think that's my problem.

Can you or someone else point me towards another thread or tutorial that deals with Insert SQL strings, so I can go that route and dump the FP form?

Todd




Spooky -> RE: DB update form confirmation page (10/11/2005 20:07:07)

Have you tried Duanes suggestion - that should be all you need.
Perhaps we arent understanding otherwise?




BeTheBall -> RE: DB update form confirmation page (10/11/2005 22:59:57)

I think the problem is he is using the "Send to Database" option with a custom confirmation page so the form values are dumped before getting to the confirmation page. However, Todd, you already know the ID number before you submit to the db so just append it to the URL in the redirect. On the page with your form, find the line that looks like this:

Response.Redirect "details_thoughts_input_confirm.asp"

and change to:

Response.Redirect "details_thoughts_input_confirm.asp?ID="&Request.QueryString("ID")

Then on the confirmation page use:

http://www.alea1.org/memorial/details_thoughts.asp?ID=<%=Request.QueryString("ID")%>

That should work for you.




ttjager -> RE: DB update form confirmation page (10/12/2005 6:15:42)


quote:

ORIGINAL: BeTheBall

Response.Redirect "details_thoughts_input_confirm.asp"

and change to:

Response.Redirect "details_thoughts_input_confirm.asp?ID="&Request.QueryString("ID")

Then on the confirmation page use:

http://www.alea1.org/memorial/details_thoughts.asp?ID=<%=Request.QueryString("ID")%>



I think we're real close on this, but something seems to be amiss with one of the two commands Duane has above. The link is appearing on the confirmation page, but no "ID" is displayed within the link, so it simply comes up: http://www.alea1.org/memorial/details_thoughts.asp?ID=

We've got to have one little parameter off somewhere.

Todd




BeTheBall -> RE: DB update form confirmation page (10/12/2005 10:11:52)

Can you post the code for details_thoughts_input.asp?




ttjager -> RE: DB update form confirmation page (10/12/2005 14:27:56)

I noticed something when copying the code for this reply.

When I change the line:

Response.Redirect "details_thoughts_input_confirm.asp"

to

Response.Redirect "details_thoughts_input_confirm.asp?ID="&Request.QueryString("ID")

as Duane suggested, everything looks fine after I save it. However, when I close the file and reopen it, the line still reads:

Response.Redirect "details_thoughts_input_confirm.asp

Here is ALL the code for details_thoughts_input.asp:


<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.

On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Session.LCID = 1033
Err.Clear

strErrorUrl = ""

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
	Err.Clear

	Set fp_conn =  Server.CreateObject("ADODB.Connection")
	FP_DumpError strErrorUrl, "Cannot create connection"

	Set fp_rs = Server.CreateObject("ADODB.Recordset")
	FP_DumpError strErrorUrl, "Cannot create record set"

	fp_conn.Open Application("memorial_ConnectionString")
	FP_DumpError strErrorUrl, "Cannot open database"

	fp_rs.Open "thoughts", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
	FP_DumpError strErrorUrl, "Cannot open record set"

	fp_rs.AddNew
	FP_DumpError strErrorUrl, "Cannot add new record set to the database"
	Dim arFormFields0(3)
	Dim arFormDBFields0(3)
	Dim arFormValues0(3)

	arFormFields0(0) = "thought"
	arFormDBFields0(0) = "thought"
	arFormValues0(0) = Request("thought")
	arFormFields0(1) = "ID"
	arFormDBFields0(1) = "ID"
	arFormValues0(1) = Request("ID")
	arFormFields0(2) = "name"
	arFormDBFields0(2) = "name"
	arFormValues0(2) = Request("name")

	FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0

	FP_SaveFieldToDB fp_rs, Now, "date"

	fp_rs.Update
	FP_DumpError strErrorUrl, "Cannot update the database"

	fp_rs.Close
	fp_conn.Close

	Session("FP_SavedFields")=arFormFields0
	Session("FP_SavedValues")=arFormValues0
	Session.CodePage = Session("FP_OldCodePage")
	Session.LCID = Session("FP_OldLCID")
	Response.Redirect "details_thoughts_input_confirm.asp"

End If
End If

Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")

%>
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" type="text/css" href="../memorial.css">
<title>ALEA - Fallen Hero Memorial - Thoughts & Memories Input Form</title>
</head>

<body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" rightmargin="0">

<body>

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
  <tr>
    <td width="100%">
    <!--webbot bot="Include" U-Include="../includes/memorial_mast.htm" TAG="BODY" --></td>
  </tr>
  <tr>
    <td width="100%" valign="top">
    <div align="center">
      <center>
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="550" id="AutoNumber2">
        <tr>
    <td width="100%">
    <div align="center">
      <center>
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="550" id="AutoNumber3">
        <tr>
          <td width="15" height="30">
          <img border="0" src="images/box/upper_left.jpg"></td>
          <td height="30" background="images/box/top.jpg"></td>
          <td width="15" height="30">
          <img border="0" src="images/box/upper_right.jpg"></td>
        </tr>
        <tr>
          <td width="15" background="images/box/left.jpg"></td>
          <td>
    <!--#include file="../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
    </SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM names WHERE (ID =  ::ID::) ORDER BY lastname ASC,firstname ASC"
fp_sDefault="ID="
fp_sNoRecords="No records returned."
fp_sDataConn="memorial"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice="date"
fp_sMenuValue="date"
fp_sColTypes="&ID=3&date=135&lastname=202&firstname=202&agency=203&state=202&aircraft=202&details=203&link=202&photo=202&patch=202&reviewed=11&"
fp_iDisplayCols=10
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1.inc"-->
<div align="center">
            <center>
            <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="475" id="AutoNumber4">
              <tr>
                <td width="475" colspan="3">
                <p align="center">
    <b>
    <i>In Memory Of</i></b></p>
          <h1 align="center">
    <b>
    <%=FP_FieldVal(fp_rs,"firstname")%> 
    <%=FP_FieldVal(fp_rs,"lastname")%></b></h1>
    <h2 align="center">
    <span style="font-style: normal">
    <%=FP_FieldVal(fp_rs,"agency")%>,
    <%=FP_FieldVal(fp_rs,"state")%><br>
    End of watch: 
    <%=FP_FieldVal(fp_rs,"date")%><br>
    Aircraft: 
    <%=FP_FieldVal(fp_rs,"aircraft")%></span></h2>
                </td>
              </tr>
              <tr>
                <td width="237">
                <div align="right">
                <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber6">
                  <tr>
                      <td width="5" height="5">
                      <img border="0" src="images/photo_box/upper_left.jpg"></td>
                      <td height="5" background="images/photo_box/top.jpg"></td>
                      <td width="12" height="5">
                      <p align="right">
                      <img border="0" src="images/photo_box/upper_right.jpg"></td>
                    </tr>
                    <tr>
                      <td width="5" background="images/photo_box/left.jpg"></td>
                      <td width="100" height="125" background="images/photo_box/spacer.gif">
                      <p align="center">
                      <img border="0" src="images/heros/<%=FP_FieldLink(fp_rs,"photo")%>"></td>
                      <td width="12" background="images/photo_box/right.jpg"></td>
                    </tr>
                    <tr>
                      <td width="5" height="13">
                      <img border="0" src="images/photo_box/lower_left.jpg"></td>
                      <td background="images/photo_box/bottom.jpg" height="13"></td>
                      <td width="12" height="13">
                      <img border="0" src="images/photo_box/lower_right.jpg"></td>
                  </tr>
                </table>
                </div>
                </td>
                <td width="9">
                 </td>
                <td width="229">
                <img border="0" src="images/patches/<%=FP_FieldLink(fp_rs,"patch")%>" align="left"></td>
              </tr>
              </table>
            </center>
          </div>
        <h3 align="center"><span style="font-weight: 400">Leave your Thoughts or Memories 
        of </span>
    <b>
        <span style="font-weight: 400">
    <%=FP_FieldVal(fp_rs,"firstname")%></span>
        <span style="font-weight: 400">
    <%=FP_FieldVal(fp_rs,"lastname")%>.</span></b></h3>
    <!--#include file="../_fpclass/fpdbrgn2.inc"-->
<table border="0" cellpadding="10" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber7">
      <tr>
        <td width="100%">
        <form method="POST" action="--WEBBOT-SELF--">
          <!--webbot bot="SaveDatabase" suggestedext="asp" u-asp-include-url="../_fpclass/fpdbform.inc" s-dataconnection="memorial" s-recordsource="thoughts" u-database-url="../fpdb/memorial.mdb" u-confirmation-url="details_thoughts_input_confirm.asp" s-builtin-fields="Timestamp" s-builtin-dbfields="date" s-form-fields="thought ID name" s-form-dbfields="thought ID name" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include file="../_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase" endspan i-checksum="34604" --><p>
          Your Name (may be left anonymous):<br>
          <input type="text" name="name" size="35" value="anonymous"></p>
          <p>Your Thoughts or Memories of this fallen hero:<br>
          <textarea rows="10" name="thought" cols="56"></textarea><br>
</p>
          <p align="center"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
          <input type="hidden" name="ID" value="<%=Request.querystring("ID")%>">
        </form>
        <p> </td>
      </tr>
      </table>
          </td>
          <td width="15" background="images/box/right.jpg"> </td>
        </tr>
        <tr>
          <td width="15" height="17">
          <img border="0" src="images/box/lower_left.jpg"></td>
          <td height="17" background="images/box/bottom.jpg"> </td>
          <td width="15" height="17">
          <img border="0" src="images/box/lower_right.jpg"></td>
        </tr>
      </table>
      </center>
    </div>
    </td>
        </tr>
        <tr>
    <td width="100%">
    <p align="justify"><br>
    Do you have more information about this fallen 
    hero?  Help us maintain an accurate and fitting tribute to the men and 
    women who have made the ultimate sacrifice. 
    <a href="http://www.alea.org/public/memorial/updates/update_form.htm">Please provide us with 
    corrections and/or additional information</a>.</p>
    </td>
        </tr>
      </table>
      </center>
    </div>
    <p> </td>
  </tr>
  <tr>
    <td width="100%">
    <!--webbot bot="Include" U-Include="../includes/copyrights_footer.htm" TAG="BODY" --></td>
  </tr>
</table>

</body>

</html>



Todd




BeTheBall -> RE: DB update form confirmation page (10/12/2005 16:04:32)

I don't think the idea of adding the parameter at the end of the Response.Redirect will work any way so don't worry about the fact that FP undoes the change. Instead, for the URL to go from the confirmation page back to the record, try this:

http://www.alea1.org/memorial/details_thoughts.asp?ID=<%=Session("("FP_SavedValues")(1)%>




ttjager -> RE: DB update form confirmation page (10/12/2005 16:32:07)

Adding that link anywhere on the confirmation page, causes the page to crash and display:

The page cannot be displayed 
There is a problem with the page you are trying to reach and it cannot be displayed. 

HTTP 500 - Internal server error 
Internet Explorer  


Remove the link and the page displays fine.

The form does post to the DB irregardless of whether the confirmation page displays or not.




BeTheBall -> RE: DB update form confirmation page (10/12/2005 16:54:16)

Oops. typo. Try this one.

http://www.alea1.org/memorial/details_thoughts.asp?ID=<%=Session("FP_SavedValues")(1)%>

If you get the same error message, go into IE, then tools, then Internet Options, Advanced tab and then scroll down and uncheck the box labeled, "Show friendly http error messages". This will give us a better idea of what the error is.




ttjager -> RE: DB update form confirmation page (10/12/2005 17:14:05)

OK, that link on details_thoughts_input_confirm.asp returns:


Microsoft VBScript runtime error '800a000d' 

Type mismatch: '[string: ""]' 

/memorial/details_thoughts_input_confirm.asp, line 122 



This is the code for details_thoughts_input_confirm.asp

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" type="text/css" href="../memorial.css">
<title>ALEA - Fallen Hero Memorial - Details</title>
</head>

<body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" rightmargin="0">

<body>

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
  <tr>
    <td width="100%">
    <!--webbot bot="Include" U-Include="../includes/memorial_mast.htm" TAG="BODY" --></td>
  </tr>
  <tr>
    <td width="100%" valign="top">
    <div align="center">
      <center>
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="550" id="AutoNumber2">
        <tr>
    <td width="100%">
    <div align="center">
      <center>
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="550" id="AutoNumber3">
        <tr>
          <td width="15" height="30">
          <img border="0" src="images/box/upper_left.jpg" width="30" height="30"></td>
          <td height="30" background="images/box/top.jpg"></td>
          <td width="15" height="30">
          <img border="0" src="images/box/upper_right.jpg" width="24" height="30"></td>
        </tr>
        <tr>
          <td width="15" background="images/box/left.jpg"></td>
          <td>
    <p align="center">Thank you for taking the time to share your <br>
    Thoughts and Memories of this Fallen Hero.</p>
    <p align="center"><font color="#FF0000">Testing information only:</font></p>
    <p align="center">The following lines are simple FP confirmation fields:</p>
    <p align="center">ID = <b>
    <!--webbot bot="ConfirmationField" S-Field="ID" --></b></p>
    <p align="center">Your name = <b>
    <!--webbot bot="ConfirmationField" S-Field="name" --></b></p>
    <p align="center">Comments = <b>
    <!--webbot bot="ConfirmationField" S-Field="thought" --></b></p>
    <p align="center">The following link should take you back to the "thoughts" 
    page:</p>
    <p align="center"><b>
    <a href="details_thoughts.asp?ID=<%=Session("FP_SavedValues")(1)%>">Test link 
    back to thoughts page</a></b></p>
    <p align="center"> </p>
    <p> </td>
          <td width="15" background="images/box/right.jpg"> </td>
        </tr>
        <tr>
          <td width="15" height="17">
          <img border="0" src="images/box/lower_left.jpg" width="30" height="24"></td>
          <td height="17" background="images/box/bottom.jpg"> </td>
          <td width="15" height="17">
          <img border="0" src="images/box/lower_right.jpg" width="25" height="24"></td>
        </tr>
      </table>
      </center>
    </div>
    </td>
        </tr>
        <tr>
    <td width="100%">
    <p align="justify"><br>
    Do you have more information about this fallen 
    hero?  Help us maintain an accurate and fitting tribute to the men and 
    women who have made the ultimate sacrifice. 
    <a href="http://www.alea.org/public/memorial/updates/update_form.htm">Please provide us with 
    corrections and/or additional information</a>.</p>
    </td>
        </tr>
      </table>
      </center>
    </div>
    <p> </td>
  </tr>
  <tr>
    <td width="100%">
    <!--webbot bot="Include" U-Include="../includes/copyrights_footer.htm" TAG="BODY" --></td>
  </tr>
</table>

</body>

</html>


Todd




BeTheBall -> RE: DB update form confirmation page (10/12/2005 18:33:31)

I am stumped. I tested this and have the following link on the confirmation page:

<a href="details.asp?FName=<%=Session("FP_SavedValues")(0)%>">

It works perfectly.

On your confirmation page, see if you get the same error if you try to simply write the session variable, i.e.,

<%=Session("FP_SavedValues")(1)%>




ttjager -> RE: DB update form confirmation page (10/13/2005 1:49:38)

It was the !@#$% FrontPage confirmation fields! I had them on the confirmation page just as a reference. They came before the link we have been working on. As soon as I removed those !@#$% confirmation fields, the last link Duane provided worked perfectly!

details_thoughts.asp?ID=<%=Session("FP_SavedValues")(1)%>

Thanks for all help Duane and Spooky! You guys are my heros - I must admit I thought I had stumped you this time though.

Thanks again!!

Todd




BeTheBall -> RE: DB update form confirmation page (10/13/2005 9:29:22)

[sm=yupi3ti.gif]

Glad you got it. I hate losing.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.171875