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

HOW TO CODE BOTH UPDATE AND DELETE BUTTON ON ONE WEB PAGE

Status
Not open for further replies.

Coding

Programmer
Aug 13, 2000
25
0
0
CA
Hi,
does anyone know how to get together DELETE and UPDATE buttons on one page. Actually, I can code them separately on two pages. So I must have a link for one of them to go to another page and to use the another button.
The form is being submitted by one button only to one unique page while it is a problem to have another button submitting the same form to another page. It can be done in Visual Basic easily, but with ASP is pretty different.
 
You could create a hidden field and then set the value dependant on which button is clicked:
Code:
<html>
<body>
<form method=POST action=&quot;myPage.asp&quot; name=&quot;frmUpdate&quot;>
<input type=&quot;hidden&quot; name=&quot;next_action&quot; value=&quot;&quot;>

blah blah content content, form inputs, etc

<input type=&quot;submit&quot; value=&quot;update&quot; onClick=&quot;frmUpdate.next_action.value='update';&quot;>
<input type=&quot;submit&quot; value=&quot;delete&quot; onClick=&quot;frmUpdate.next_action.value='delete';&quot;>
</body>
</html>


Another method for doing this is to have a checkbox with the words &quot;delete me&quot; next to it. If the checkbox has a value on the next page then it was checked and you should delete, otherwise do your update:
Code:
<html>
<body>
<form method=POST action=&quot;myPage.asp&quot; name=&quot;frmUpdate&quot;>
blah blah content content, form inputs, etc
<input type=&quot;checkbox&quot; name=&quot;deleteCheck&quot; value=&quot;delete&quot;>
<input type=&quot;submit&quot;>
</body>
</html>

'on next page:
If Request.Form(&quot;deletecheck&quot;) <> &quot;&quot; Then
   'do my delete stuff
Else
   'do my update stuff
End If


That should give you some ideas,
-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
This space has nothing in it, it's all ni your imagination
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top