Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 14th, 2004, 03:11 PM
Authorized User
 
Join Date: Sep 2004
Posts: 68
Thanks: 1
Thanked 0 Times in 0 Posts
Default Doing work after the submit form

I need to execute some code AFTER I execute a submit form command.

Is this possible?

In my code below, you can see that the submit button is just a button and not a true submit button. I do this so I can edit my fields for content. I need to execute extra code after the frmOpponents.submit line executes.

thanks for your help!

sal

here's my code:::::::::::::::::::::::::::::::::::::::::::::: :::

<form name="frmOpponents" method="post" action="addOpponents.asp">

<table width="544" border="0" cellspacing="0" cellpadding="5">
<tr><td class="body" width="168">Opponent Team Name:</td>
  <td width="356"> <input name="txtOpponentName" type="text" id="txtOpponentName" size=55 maxlength=50 value=<% response.write strOpponentName%>></td></tr>
 <tr align="center"><td align="left">&nbsp; </td>
<td align="left"> <input type="button" name="cmdReturn" value="Return">
<input type="reset" name="cmdReset" value="Reset">
<input type="button" name="cmdSubmit" value="Submit">
                                    </td>
                                  </tr>
                                </table>
                                <br>
                              </form>

</html>
<SCRIPT LANGUAGE="VBSCRIPT">
Sub cmdSubmit_onclick()
if document.frmOpponents.txtOpponentName.value = "" then
    msgbox "Please enter a valid name.",vbCritical,strWebPageName
    document.frmOpponents.txtOpponentName.focus
    exit sub
end if

frmOpponents.submit

End Sub

</SCRIPT>

 
Old October 14th, 2004, 03:36 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Hey Sal,

What could you possibly want to do before the page changes that you couldn't do before the submit or after the change?

Just wondering...

-Snib <><
Try new FreshView 0.2!
There are only two stupid questions: the one you don't ask, and the one you ask more than once ;)
 
Old October 14th, 2004, 03:37 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Why not do whatever else you need to do then submit the form? Otherwise, add code to do the extra stuff in the addOpponents.asp page. I don't think you will be able to access it. There you can check the Request.ServerVariables("HTTP_REFERER") for the name of the referring page. When this page, then perform this action.

Brian

Brian
 
Old October 14th, 2004, 03:56 PM
Authorized User
 
Join Date: Sep 2004
Posts: 68
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I'm in the process of demoing wysiwyg software.

This software executes code on standard form submission like this:

code snipet from the form:::::::::::::::::::::::::::
<form action="blablabla..." name="frmMain" onSubmit="eWebEditProCopyValue();" method="POST">

javascript executed upon form submission:::::::::::::::::::::
<script language="JavaScript">
 function eWebEditProCopyValue() {
    document.frmMain.TextHTML1.value = document.frmMain.eWebEditPro1.TextHTML;
 }
</script>

:::::::::::::::::::::::::::::
the above code uses a submit button of type submit.

all of my code uses a submit button of type "button". I do this so I can check for errors and pop up an error message; however, if there's no error message, I can simply execute "frmOpponents.submit".


 
Old January 30th, 2005, 03:15 PM
Authorized User
 
Join Date: Jan 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you can deny a submit even by using a <input type=submit> ... herez how you might do it ...

<input type=submit onClick="anyFunction()">

and herez the javascript part...

function anyFunction()
{







Similar Threads
Thread Thread Starter Forum Replies Last Post
Form Submit Problem. muklee Javascript 7 May 27th, 2007 10:06 PM
Form Submit Nitin_sharma Javascript 1 December 2nd, 2004 08:51 AM
submit in If statment not work abbylee26 Javascript How-To 1 February 11th, 2004 12:22 AM
How can we submit a form without a submit butto phpsharma BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 4 October 20th, 2003 08:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.