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: 224
  • Last Modified:

Front page form + additional asp code????

My Client has written his own frontpage form that posts to an Access database.
The page is asp.

He now wants me to add code to build a query string from the entry posted and forward to an email address.

All of which I can write, but cant figure out a way of adding a server side function to the form.

Any one got any ideas?
I have tried adding a clientside function call on the onsubmit, that updates a textbox,then have a server script checking the value of the textbox. But the frontpage webots seem to go mental and break the page.

Re-writing the page in real vb script would obviously fix the problem, but is not an option due to budget and time.

Thanks
Andy
0
andy_booth
Asked:
andy_booth
1 Solution
 
memerotCommented:
You need to re-architect unfortunately.  The code is very small.  The page NEEDS to post to itself first so that you can do the email.  Then it can send the info off to the first target.

So you have the form post to itself:

<form action="myPage.asp" method="post">
<input type="hidden" name="action" value="save">
...
</form>

And you have a server side handler that does the email, and THEN resends the info.  It resends the info by writing out a copy of the form and autosubmitting it with a snip of client side javascript:
<%
If Request.Form("action") = "save" Then
   'do your email stuff, CDO, yadda yadda
   'now you write out an html form pointed at the original target
   Dim var
   %>
      <form action="originalTarget.xxx" method="post" id="frmSecondStep">
       <% For Each var In Request.Form %>
          <input type="hidden" name="<%= var %>" value="<%= Request.Form(var) %>">
       <% Next %>
      </form>
      <script language="javascript">
         // Auto submit this form
         document.getElementById("frmSecondStep").submit()
      </script>
<%
End If
%>

0
 
andy_boothAuthor Commented:
Hi,

Sorry for the delay, I guess I decided to re-write this, I had forgotten all about it.
Awarded the points anyway.

Regards
Andy
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now