PDA

View Full Version : 2 form actions?


turnknuckle
11-12-2002, 12:54 AM
Greetings
Is there a way to give a form 2 actions on submit - ive got a form that needs to get processed by 2 asp scripts - 1 is a search and the other formats and emails the contents...
Any ideas?

whammy
11-12-2002, 01:21 AM
You can simply post the page back to itself and determine what to do depending on the variables that were posted back to the page.

Can you be more specific about exactly what you're trying to accomplish? i.e.:

If Request.Form("searchbox") <> "" Then
'Run my search subroutine
Else
'If I want to email something here, maybe I would, but I really don't know since I don't know what's going on.
End If

:D

If you're trying to do something client-side, that's a different forum, but validation etc. is better done on the server-side.

whammy
11-12-2002, 01:22 AM
P.S. For a basic example of posting back to the same page like this, and validating (and this is VERY basic), check out:

http://www.solidscripts.com/email.txt

:D

turnknuckle
11-12-2002, 01:39 AM
Thanks man
Ive already written the search and the script that formats and mails the form contents, my client wants the form, once filled out to give the user some feedback (which will mean action = "search.asp") as well as mailing the contents to them (client) which will mean action = "mail.asp"
I was just wondering if there was a way to make the form do both of those things on submit...:)

whammy
11-12-2002, 01:41 AM
Just email the client whenever you post to the search page. That's invisible to the user.

:)

I'd research subroutines if I were you... then you can do many many things in the same application, on the same page, depending on the variables you use (i.e. what you tell it).