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

Multiple Submits/Resets in a single form??

Status
Not open for further replies.

InShadows

IS-IT--Management
Jul 7, 2000
36
US
I was wondering if I can do multiple submits in a single form. How it would work is if they click on the Submit with the value of Submit to Final then the data would be sent to the database and a column labeled status would say Final. Another Submit button would have the value of Submit to Drafts and the column labeled status would say Draft and then if they clicked on Reset it would revert back to the saved copy or clear if there is no copy present. I am having a hard time with the two submit buttons. I know I could use a radio button but is that my only choice?

thanx InShadows

I couldn't think of a sig so here it is.
 
Why not just use two buttons (type 'button')? Each button would do its own thing.
 
It is currently three buttons..
<table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot;>
<tr>
<td>
<div align=&quot;center&quot;>
<input type=&quot;submit&quot; name=&quot;Submit2&quot; value=&quot;Save into Drafts&quot;>
</div>
</td>
<td>
<div align=&quot;center&quot;>
<input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit to Contract Analyst&quot;>
</div>
</td>
<td>
<div align=&quot;center&quot;>
<input type=&quot;reset&quot; name=&quot;Submit3&quot; value=&quot;Reset&quot;>
</div>
</td>
</tr>
</table>


I have just never worked with multiple submit buttons and need to know if I'm just wasting my time or if someone has some code that I may borrow to adapt.. InShadows

I couldn't think of a sig so here it is.
 
you could use javascript,but you could also do it this way.
just access the submits values as a normal form element. give all the submit buttons the same name and in your asp code do this:

Code:
strSubmitButton = Request(&quot;Submit&quot;)
here's a code you can use to see what happens:
Code:
<%
Dim strSubmitButton
strSubmitButton = Request(&quot;Submit&quot;)
response.write strSubmitButton
%>
<form method=post>
                  <table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot;>
                    <tr>
                      <td>
                        <div align=&quot;center&quot;>
                          <input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Save into Drafts&quot;>
                        </div>
                      </td>
                      <td>
                        <div align=&quot;center&quot;>
                          <input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit to Contract Analyst&quot;>
                        </div>
                      </td>
                      <td>
                        <div align=&quot;center&quot;>
                          <input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Reset&quot;>
                        </div>
                      </td>
                    </tr>
                  </table>
</form>

:)
 
ex.

Code:
<input type=&quot;hidden&quot; name=&quot;statusHeader&quot; value=&quot;<whatever your default is>&quot;>

<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Final&quot;>
<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Submit to Drafts&quot;>
<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Reset&quot;>
or
Code:
<input type=&quot;reset&quot; value=&quot;Reset&quot;>
(if just clearing form)


Then in your form action processing:

Code:
Select Case Request.Form(&quot;submit&quot;)
     Case &quot;Final&quot;
         statusHeader = &quot;Final&quot;
     Case &quot;Submit to Drafts&quot;
         statusHeader = &quot;Draft&quot;
     Case &quot;Reset&quot;
         statusHeader = Request.Form(&quot;statusHeader&quot;)
     Case Else
         statusHeader = Request.Form(&quot;statusHeader&quot;)
End Select

Does that answer your question?
 
yes thank you very much.. this should do the trick. recently all of my clients are avoiding javascripts so I have to do so as well.

thanks again InShadows

I couldn't think of a sig so here it is.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top