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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need 2 submit buttons!

Status
Not open for further replies.

JohannIcon

Programmer
Sep 3, 2002
440
MT
Dear All,

I have a form where i have some text fields the user must enter. Then what I need is 2 submit buttons, so that I can process these fields differently, depending on the submit button the user pressed. How can I have 2 submit buttons in one form?

Thanks for your help
 
Just make it look like there's two, have two forms

ooooooooooooooooooooooooh bugger.
 
Yeah I know you can make 2 forms, but the form is quite long and I wish to display only one form! Is that possible?
 
Why not do something like:

<input type=&quot;submit&quot; name=&quot;submit1&quot; value=&quot;Submit&quot;>
<input type=&quot;submit&quot; name=&quot;submit2&quot; value=&quot;Submit&quot;>

Then when you request the form objects use:

if request.form(&quot;submit1&quot;) <> &quot;&quot; then
..do your stuff
elseif request.form(&quot;submit2&quot;) <> &quot;&quot; then
..do your stuff
end if

or try giving the buttons different values:

<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Submit 1&quot;>
<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Submit 2&quot;>

when you request the form objects

select case(request.form(&quot;submit&quot;))
case &quot;Submit 1&quot;
'do something
case &quot;Submit 2&quot;
'do something else
case else
'don't do anything!
end select

Make any sense?
 
Yeah it does make sense, however, after pressing the submit button, i am retreiving the values in another ASP page, so for example:-

<input type=&quot;submit&quot; name=&quot;submit1&quot; value=&quot;Submit&quot;>
<input type=&quot;submit&quot; name=&quot;submit2&quot; value=&quot;Submit&quot;>

Then when you request the form objects use:

if request.form(&quot;submit1&quot;) <> &quot;&quot; then
how can i redirect to the ASP with the values and not using a request.querysting?

end if

Thanks for your help
 
how can i redirect to the ASP with the values and not using a request.querysting?

Use Server.Transfer &quot;asppage.asp&quot;


________
George, M
 
Thanks shaddow

I did the following:-

<%
if request.form(&quot;submit1&quot;) <> &quot;&quot; then
Server.Transfer (&quot;bsearchweb.asp?groupid=&quot;&groupID)
elseif request.form(&quot;submit2&quot;) <> &quot;&quot; then
Server.Transfer (&quot;bsearchisl.asp?groupid=&quot;&groupID)
end if
%>

however, I got the following message:-

Server object, ASP 0235 (0x80004005)
Invalid URL form or fully-qualified absolute URL was used. Use relative URLs.
 
Ok I fixed it. I passed the groupID var as a hidden field and then

<%
if request.form(&quot;submit1&quot;) <> &quot;&quot; then
Server.Transfer (&quot;bsearchweb.asp&quot;)
elseif request.form(&quot;submit2&quot;) <> &quot;&quot; then
Server.Transfer (&quot;bsearchisl.asp&quot;)
end if
%>
 
Not shure bu try to use
Server.Transfer &quot;bsearchweb.asp?groupid=&quot;&groupID
and not
Server.Transfer (&quot;bsearchweb.asp?groupid=&quot;&groupID)

As for the error. Are all files in same directory? or they are separate(html form, processing asp, and redirected asp)


________
George, M
 
ah interesting problem.
well as i knw sending a form as submit with both querry string or form fields works but seems to not work on Server.Transfer


________
George, M
 
No I was doing a search and found out that Server.Transfer does not allow a querystring, however you can pass the value as a hidden field in the form. I think that solves the problem
 
Yes, never did that i always use form fields instead of querry strings. But that is good to knw.
Thanks.

________
George, M
 
Well with this new term I have found today, I will try not to user querystrings anymore if that is possible since that gave me a lot of problems with site search. My site search is not working properly cause it expects a querysting.
 
Site search with Querystrings as somone sayed help bookmarking some search results.

________
George, M
 
What do you mean? I did not understand?

I tried to run a site search utility I had found in hotscripts.com, however my results were not as I would have expected since my pages were like page.asp?mainid=1 and mainid was not being retrieved. I hope you understand what I am talking about
 
What i mean is that if somone does a search and he wants to add to favorites for example it wont work without querry strings.
You cant bookmark form fields as i knw.

________
George, M
 
I think we are not understanding each other mate.

I tried to use a search site utility, but did not work cause if only retreived the name of the pages, for example page.asp and not page.asp?mainid=1.

I think it has nothing to do with forms
 
Yes that's true.
We was on different paths.

________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top