DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Jeff Guest

    Combine Client Side & Server Side?


    Is it possible to call a client side javascript function from a server side
    vbscript event?





    <SCRIPT LANGUAGE=vbscript RUNAT=server>

    Sub btnSearch_onclick()


    *** Call a javascript here to do some client side stuff before I do
    the server side stuff ***

    Session("strNDC")=Trim(txtNDC.value)
    ViewContracted.navigate.PopGrid

    End Sub


    </SCRIPT>


    How could I do something like this.... combining client and server side stuff?


  2. #2
    Kris Eiben Guest

    Re: Combine Client Side & Server Side?

    Ummm, unless I'm missing something, that sub will never run. Server-side
    code is executed and gone long before any button is visible on the client.

    You can put the _results_ of server-side code inside client-side code. Like
    so:
    <script language="Javascript">
    var a;
    a = <% set conn = server.createobject("ADODB.Connection")
    conn.open "DSN=Blah"
    set rs = conn.execute("Select field1 from table1 where
    field2=2")
    response.write rs("field1")
    %>;
    alert(a);
    </script>
    This will pop a message box with the value of field1. You cannot execute
    some server-side code, then some client-side code, then back to the server.
    Once you're on the client, you're done, unless you make a return trip to the
    server (request a page, post a form, etc).

    I've seen people suggest you use a hidden frame to do the server-side
    processing without refreshing the client's screen. Worth a try, if you
    really need the functionality.

    Jeff wrote in message <38fdfcff$1@news.devx.com>...
    >Is it possible to call a client side javascript function from a server side
    >vbscript event?
    ><SCRIPT LANGUAGE=vbscript RUNAT=server>
    > Sub btnSearch_onclick()
    > *** Call a javascript here to do some client side stuff before I do
    >the server side stuff ***
    > Session("strNDC")=Trim(txtNDC.value)
    > ViewContracted.navigate.PopGrid
    > End Sub
    ></SCRIPT>
    >How could I do something like this.... combining client and server side

    stuff?



  3. #3
    Adrian Forbes Guest

    Re: Combine Client Side & Server Side?

    Not possible.



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links