Server-Side vs Client-Side script 
Author Message
 Server-Side vs Client-Side script

I have an application that has been entirely written using server-side
script. I need to make a change to it, but I think I will have to use
client-side script to get the desired result.

My asp pages used to allow a user to select a field from a recordset (from a
SQL2000 database) and then submit the form which would call a function that
updated the database. That was pretty simple.

Now there is a new requirement to allow the user to remove fileds from the
database as well. The way I have begun to make this change is by adding an
'Add' and 'Remove' button to the form instead of the 'Submit' button. Here
is the code I used:

     <td align=center valign=middle width=10>
      <input type=button value=">>" id=AddTrail name=AddTrail></input>
      <input type=submit value="<<" id=RemTrail name=RemTrail></input>
     </td>

Then, I renamed the update function to 'AddTrail_onClick' so that it would
be called whenever a user clicked on the Add button. This method, however,
produced no result. The database was not updated and no error message was
generated.

As I mentioned earlier, I am using server-side script. Does the 'onClick'
procedure need to be in client-side script, and if so, how do I access the
database from the client-side?

Thanks,
Dave



Sun, 05 Oct 2003 23:46:37 GMT  
 Server-Side vs Client-Side script
Yes, the onClick needs to be client side.  But you wouldn't access the
database from the client side.  Have a client side function submit the info
to an asp page based upon what button was clicked.

HTH


Quote:
> I have an application that has been entirely written using server-side
> script. I need to make a change to it, but I think I will have to use
> client-side script to get the desired result.

> My asp pages used to allow a user to select a field from a recordset (from
a
> SQL2000 database) and then submit the form which would call a function
that
> updated the database. That was pretty simple.

> Now there is a new requirement to allow the user to remove fileds from the
> database as well. The way I have begun to make this change is by adding an
> 'Add' and 'Remove' button to the form instead of the 'Submit' button. Here
> is the code I used:

>      <td align=center valign=middle width=10>
>       <input type=button value=">>" id=AddTrail name=AddTrail></input>
>       <input type=submit value="<<" id=RemTrail name=RemTrail></input>
>      </td>

> Then, I renamed the update function to 'AddTrail_onClick' so that it would
> be called whenever a user clicked on the Add button. This method, however,
> produced no result. The database was not updated and no error message was
> generated.

> As I mentioned earlier, I am using server-side script. Does the 'onClick'
> procedure need to be in client-side script, and if so, how do I access the
> database from the client-side?

> Thanks,
> Dave



Mon, 06 Oct 2003 01:33:32 GMT  
 Server-Side vs Client-Side script
So the client side script will just pass the selected value to another asp
page that will execute the server side script?
Do you have some sample code of how to write this?


Quote:
> Yes, the onClick needs to be client side.  But you wouldn't access the
> database from the client side.  Have a client side function submit the
info
> to an asp page based upon what button was clicked.

> HTH



> > I have an application that has been entirely written using server-side
> > script. I need to make a change to it, but I think I will have to use
> > client-side script to get the desired result.

> > My asp pages used to allow a user to select a field from a recordset
(from
> a
> > SQL2000 database) and then submit the form which would call a function
> that
> > updated the database. That was pretty simple.

> > Now there is a new requirement to allow the user to remove fileds from
the
> > database as well. The way I have begun to make this change is by adding
an
> > 'Add' and 'Remove' button to the form instead of the 'Submit' button.
Here
> > is the code I used:

> >      <td align=center valign=middle width=10>
> >       <input type=button value=">>" id=AddTrail name=AddTrail></input>
> >       <input type=submit value="<<" id=RemTrail name=RemTrail></input>
> >      </td>

> > Then, I renamed the update function to 'AddTrail_onClick' so that it
would
> > be called whenever a user clicked on the Add button. This method,
however,
> > produced no result. The database was not updated and no error message
was
> > generated.

> > As I mentioned earlier, I am using server-side script. Does the
'onClick'
> > procedure need to be in client-side script, and if so, how do I access
the
> > database from the client-side?

> > Thanks,
> > Dave



Mon, 06 Oct 2003 01:53:35 GMT  
 Server-Side vs Client-Side script
this is quick and pretty sloppy, but it illustrates the process flow i was
thinking...

<%
Sub Start()
%>
<html>
<body>
<%
  If Request.QueryString("Y") = "" Then
   Call Collect()
  Else
   Call Process()
  End If
 End Sub
%>
</body>
</html>
<%
 Sub Collect()
%>
<Script Language=VBScript>
function btnCheck(Action)
window.navigate("?Y=" & Action)
end function
</Script>
<form name=Test method=POST onSubmit="return false">
<input type=button onClick=btnCheck("Delete") value="DELETE">
<input type=button onClick=btnCheck("Add") value="ADD">
</form>
<%
 End Sub

 Sub Process()
  Select Case Request.QueryString("Y")
  Case "Add"
   Response.Write "We would ADD to the database."
  Case "Delete"
   Response.Write "We would DELETE from the database."
  End Select
 End Sub

 Call Start()
%>



Mon, 06 Oct 2003 04:04:56 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Client side VS server side

2. Client side VS server side..

3. dumb question - fundamentals of client-side vs server-side vbscript

4. Using Server side Vs OnClick Client side

5. Client-Side vs Server-side ASP/JScript

6. DLLs -- server-side vs client-side

7. ADO-Access2000: Server-side vs Client-side cursor

8. server side (adUseServer) vs client side (adUseClient)

9. ?client-side vs server-side cursors

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

11. Client side and Server side script working together

12. Client side scripting / server side scripting

 

 
Powered by phpBB® Forum Software