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!

How to prompt a user in server side script

Status
Not open for further replies.

frogggg

Programmer
Jan 17, 2002
182
US
I have a delete button, using a dtc, and need to prompt the user with an "Are you sure?" yes/no after he clicks the button, but before the delete takes place. I have the delete in a server side event handler:

<SCRIPT ID=serverEventHandlersVBS LANGUAGE=vbscript RUNAT=Server>
Sub btnDelete_onclick()
rsPost.deleteRecord
End Sub

</SCRIPT>

I figured I'd use the javascript confirm, and I know I need some combination of response.writes, but if I tried to do
response.write &quot;<script language='javascript'>&quot; _
&quot;confirm(msgConfirm)&quot; _
&quot;</script>&quot;

the </script> ended the whole sub, and I also know I need some if logic in here somewhere.

Please help me sort this out. Thanks.
 
Why not just include the confirm in the onClick for the delete button, or the onSubmit for the form?

Code:
<form method=POST action&quot;wherever.asp&quot; onSubmit=&quot;return confirm('Are you sure?');&quot;>
form stuff
<input type=submit value=Delete onClick=&quot;return confirm('Are You Sure?');&quot;>
</form>

or

Code:
<form method=POST action&quot;wherever.asp&quot;>
   form stuff
<input type=submit value=Delete onClick=&quot;return confirm('Are You Sure?');&quot;>
</form>

If you really want to do it serverside calling clientside, break up the <script> tags:
Code:
response.write &quot;<scr&quot; & &quot;ipt language='javascript'>&quot; _
  &quot;confirm(msgConfirm)&quot; _
  &quot;</scr&quot; & &quot;ipt>&quot;

-Tarwn
 
I should have mentioned that your server-sode script should be writing that last one, not your ASP, or you'll have the same problem
-Tarwn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top