Call Server Side Script From Client Side Script 
Author Message
 Call Server Side Script From Client Side Script

I want to run the DeleteRecords sub when a user clicks the delete button and
answers yes to the question about if they are sure they want to delete.  The
code never makes it inside the If statement on the server side where the
delete happens, the value of "rtn" doesn't get passed to the server side.
Do you know how I can do this?  I want to be able to get a response from the
user before doing a delete.  Thanks.

<SCRIPT RUNAT=Server LANGUAGE="VBScript">
Sub DeleteRecords

 Response.Write ("Before Delete " & Request("rtn"))

 If Request("rtn") = vbYes and Len(Trim(txtItem_ID.value)) <> 0 Then

  Response.Write ("In Delete " & Request("rtn"))

  'Delete all of the Counties in County Restriction table for the
  'current Item_ID.
  Set Conn = Server.CreateObject("ADODB.Connection")
  Conn.open "DSN=FmDS;"
  SQLStmt = "DELETE FROM County_Restrictions "
  SQLStmt = SQLStmt & "WHERE (Item_ID = " & txtItem_ID.value & ")"
  Set rs = Conn.Execute(SQLStmt)

  'Delete all of the Items in Items table for the
  'current Item_ID.
  SQLStmt = "DELETE FROM Items "
  SQLStmt = SQLStmt & "WHERE (Item_ID = " & txtItem_ID.value & ")"
  Set rs = Conn.Execute(SQLStmt)
  Set rs = Nothing
  Conn.Close
  Set Conn = Nothing
 End If
End Sub
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function btnDelete_onclick()
 'Delete record.
 rtn = MsgBox("Are you sure you wish to Delete?",
vbYesNo+vbQuestion+vbDefaultButton2,"Delete Record?")
 If rtn = vbYes Then
  <%DeleteRecords%>
 Else
  Exit Function
 End If
End Function

</SCRIPT>



Tue, 29 May 2001 03:00:00 GMT  
 Call Server Side Script From Client Side Script

Quote:
>I want to run the DeleteRecords sub when a user clicks the delete button

ASP no longer "exists" by the time the user can see anything on their
screen.

You have to submit a form.
You can use a confirm to make sure they want to delete it before submitting
the form.

   ______
   ab/mvp

   www.desktop.on.ca
   www.swynk.com/friends/bertrand/



Tue, 29 May 2001 03:00:00 GMT  
 Call Server Side Script From Client Side Script
I Believe what you want to do is part of RDS. (Remote Data Services)  There
are
a number of ways of handing the server functions, with different levels of
security,
The Lowest security is to call a standard ASP page.  The highest is to use a
Com
business object.  Go to the Microsoft Universal Data Objects and follow the
chain go RDS/RDO.

You will need a client and server object to do the communication.


Quote:
>I want to run the DeleteRecords sub when a user clicks the delete button
and
>answers yes to the question about if they are sure they want to delete.
The
>code never makes it inside the If statement on the server side where the
>delete happens, the value of "rtn" doesn't get passed to the server side.
>Do you know how I can do this?  I want to be able to get a response from
the
>user before doing a delete.  Thanks.

><SCRIPT RUNAT=Server LANGUAGE="VBScript">
>Sub DeleteRecords

> Response.Write ("Before Delete " & Request("rtn"))

> If Request("rtn") = vbYes and Len(Trim(txtItem_ID.value)) <> 0 Then

>  Response.Write ("In Delete " & Request("rtn"))

>  'Delete all of the Counties in County Restriction table for the
>  'current Item_ID.
>  Set Conn = Server.CreateObject("ADODB.Connection")
>  Conn.open "DSN=FmDS;"
>  SQLStmt = "DELETE FROM County_Restrictions "
>  SQLStmt = SQLStmt & "WHERE (Item_ID = " & txtItem_ID.value & ")"
>  Set rs = Conn.Execute(SQLStmt)

>  'Delete all of the Items in Items table for the
>  'current Item_ID.
>  SQLStmt = "DELETE FROM Items "
>  SQLStmt = SQLStmt & "WHERE (Item_ID = " & txtItem_ID.value & ")"
>  Set rs = Conn.Execute(SQLStmt)
>  Set rs = Nothing
>  Conn.Close
>  Set Conn = Nothing
> End If
>End Sub
></SCRIPT>

><SCRIPT LANGUAGE="VBScript">
>Function btnDelete_onclick()
> 'Delete record.
> rtn = MsgBox("Are you sure you wish to Delete?",
>vbYesNo+vbQuestion+vbDefaultButton2,"Delete Record?")
> If rtn = vbYes Then
>  <%DeleteRecords%>
> Else
>  Exit Function
> End If
>End Function

></SCRIPT>



Sat, 02 Jun 2001 03:00:00 GMT  
 Call Server Side Script From Client Side Script
Look into Remote Scripting.


Mon, 04 Jun 2001 03:00:00 GMT  
 Call Server Side Script From Client Side Script
I am trying to do something like this.

I want to confirm first if a user really wants to send email or not.

Following is what I have:

<INPUT TYPE="button" NAME="DataAction" VALUE="Send Email" onClick = "if
(confirm('Are you sure you want to send an email to disable an account?') then
this.form.submit()">

This doesn't work.  I want to confirm first before sending an email.   I got
this to work on JavaScript but not on VBScript.  However, on VBScript, if I
don't have the IF statement and leave just the confirm statement, it shows a
confirmation dialog box.

Any ideas how to achieve what I want?

Thanks,
Arlynn R. Atienza


Quote:

> >I want to run the DeleteRecords sub when a user clicks the delete button

> ASP no longer "exists" by the time the user can see anything on their
> screen.

> You have to submit a form.
> You can use a confirm to make sure they want to delete it before submitting
> the form.

>    ______
>    ab/mvp

>    www.desktop.on.ca
>    www.swynk.com/friends/bertrand/



Tue, 05 Jun 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Calling Server Side Script from Client Side Script

2. Client side scripting / server side scripting

3. Accessing Data generated with client-side script from server-side script

4. Client side scripting / server side scripting

5. ASP referring to server side variables in client side script

6. Client side and Server side script working together

7. Client Side + Server Side Scripts

8. Client Side and Server Side Scripts

9. Server Side writing Client Side scripts

10. Passing Server Side Arrays to Client Side Scripts

11. Mixing of client-side and server-side scripts

12. Server side variables to client side script?

 

 
Powered by phpBB® Forum Software