client side asp within server side asp

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JT

    client side asp within server side asp

    im trying to use the following code to log whenever a user clicks through
    this particlular message box - however, this currently logs regardless of
    whether or not the message box was clicked - im assuming this is because the
    server-side code can't see the client side if condition. but how can i set
    the varMsgBox variable as a server-side variable?

    <!--switch to client-side VBScript to use the MsgBox-->
    <script language="VBSCR IPT">
    dim varMsgBox
    varMsgBox = "0"
    varMsgBox = MsgBox ("<%=pop_up_tex t%>", 16, "Urgent Message")
    'log that user clicked through the pop-up message - switch back to
    server-side to call function to insert log message into the db
    if varMsgBox = "1" then
    <% Call dumplogfile("Us er clicked through the pop-up message: " &
    pop_up_text)%>
    end if
    </script>


  • Bob Barrows [MVP]

    #2
    Re: client side asp within server side asp

    JT wrote:[color=blue]
    > im trying to use the following code to log whenever a user clicks
    > through this particlular message box - however, this currently logs
    > regardless of whether or not the message box was clicked - im
    > assuming this is because the server-side code can't see the client
    > side if condition. but how can i set the varMsgBox variable as a
    > server-side variable?
    >[/color]
    You can't. All server-side code runs before client-side code is processed.


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Comment

    • JT

      #3
      Re: client side asp within server side asp

      but isn't there a way to somehow do it along the lines of what is discussed
      in this article?




      "Bob Barrows [MVP]" <reb01501@NOyah oo.SPAMcom> wrote in message
      news:OWxgJ9qlEH A.2224@tk2msftn gp13.phx.gbl...[color=blue]
      > JT wrote:[color=green]
      > > im trying to use the following code to log whenever a user clicks
      > > through this particlular message box - however, this currently logs
      > > regardless of whether or not the message box was clicked - im
      > > assuming this is because the server-side code can't see the client
      > > side if condition. but how can i set the varMsgBox variable as a
      > > server-side variable?
      > >[/color]
      > You can't. All server-side code runs before client-side code is processed.
      >
      >
      > --
      > Microsoft MVP -- ASP/ASP.NET
      > Please reply to the newsgroup. The email account listed in my From
      > header is my spam trap, so I don't check it very often. You will get a
      > quicker response by posting to the newsgroup.
      >
      >[/color]


      Comment

      • Bob Lehmann

        #4
        Re: client side asp within server side asp

        No, because by the time the message box comes up, control has switched to
        the client.

        Bob Lehmann

        "JT" <jt@nospam.co m> wrote in message
        news:eDY73VrlEH A.1904@TK2MSFTN GP09.phx.gbl...[color=blue]
        > but isn't there a way to somehow do it along the lines of what is[/color]
        discussed[color=blue]
        > in this article?
        >
        > http://www.aspfaq.com/show.asp?id=2198
        >
        >
        > "Bob Barrows [MVP]" <reb01501@NOyah oo.SPAMcom> wrote in message
        > news:OWxgJ9qlEH A.2224@tk2msftn gp13.phx.gbl...[color=green]
        > > JT wrote:[color=darkred]
        > > > im trying to use the following code to log whenever a user clicks
        > > > through this particlular message box - however, this currently logs
        > > > regardless of whether or not the message box was clicked - im
        > > > assuming this is because the server-side code can't see the client
        > > > side if condition. but how can i set the varMsgBox variable as a
        > > > server-side variable?
        > > >[/color]
        > > You can't. All server-side code runs before client-side code is[/color][/color]
        processed.[color=blue][color=green]
        > >
        > >
        > > --
        > > Microsoft MVP -- ASP/ASP.NET
        > > Please reply to the newsgroup. The email account listed in my From
        > > header is my spam trap, so I don't check it very often. You will get a
        > > quicker response by posting to the newsgroup.
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Bob Barrows [MVP]

          #5
          Re: client side asp within server side asp

          No, that article talks about what you've successfully done: cause a
          client-side action from from server-side code. It's a one-way street. Data
          can only be passed to server-side code via the Request object, which only
          exists when the page is initially called.

          To do what you want will involve another page.

          Bob Barrows

          JT wrote:[color=blue]
          > but isn't there a way to somehow do it along the lines of what is
          > discussed in this article?
          >
          > http://www.aspfaq.com/show.asp?id=2198
          >
          >
          > "Bob Barrows [MVP]" <reb01501@NOyah oo.SPAMcom> wrote in message
          > news:OWxgJ9qlEH A.2224@tk2msftn gp13.phx.gbl...[color=green]
          >> JT wrote:[color=darkred]
          >>> im trying to use the following code to log whenever a user clicks
          >>> through this particlular message box - however, this currently logs
          >>> regardless of whether or not the message box was clicked - im
          >>> assuming this is because the server-side code can't see the client
          >>> side if condition. but how can i set the varMsgBox variable as a
          >>> server-side variable?
          >>>[/color]
          >> You can't. All server-side code runs before client-side code is
          >> processed.
          >>
          >>
          >> --
          >> Microsoft MVP -- ASP/ASP.NET
          >> Please reply to the newsgroup. The email account listed in my From
          >> header is my spam trap, so I don't check it very often. You will get
          >> a quicker response by posting to the newsgroup.[/color][/color]

          --
          Microsoft MVP - ASP/ASP.NET
          Please reply to the newsgroup. This email account is my spam trap so I
          don't check it very often. If you must reply off-line, then remove the
          "NO SPAM"


          Comment

          • Ray Costanzo [MVP]

            #6
            Re: client side asp within server side asp

            1. With your particular example, will the response from your msgbox ever be
            anything but 1? You don't leave the user many options when you have only
            "vbOK"

            2. Since your usage of VBScript in the browser already indicates you are
            into doing things in an unorthodox way (said with a "<g>" of course!), you
            could do something like so:

            yourpage.asp:

            <%
            Dim pop_up_text
            pop_up_text = "All your base are belong to us"
            %>
            <img id="x" style="display: none;" />

            <script type="text/javascript">
            //sorry, I cannot bring myself to use vbscript,

            if(confirm('<%= pop_up_text%>') ) {
            var o = document.getEle mentById('x');
            x.src =
            './process.asp?use r=IdentifiedSom ehow&m=<%=Serve r.URLEncode(pop _up_text)%>';
            }
            </script>



            process.asp:

            <%
            Dim sUser, sMessage, oCDO
            sUser = Request.Queryst ring("user")
            sMessage = Request.Queryst ring("m")
            Set oCDO = CreateObject("C DO.Message")
            oCDO.From = "your@yourdomai n.kom"
            oCDO.To = "you@yourdomain .kom"
            oCDO.Subject = "User clicked OK"
            oCDO.TextBody = sUser & " clicked OK to a prompt of " & sMessage
            oCDO.Send
            Set oCDO = Nothing
            %>




            Ray at work





            "JT" <jt@nospam.co m> wrote in message
            news:eDY73VrlEH A.1904@TK2MSFTN GP09.phx.gbl...[color=blue]
            > but isn't there a way to somehow do it along the lines of what is
            > discussed
            > in this article?
            >
            > http://www.aspfaq.com/show.asp?id=2198
            >
            >
            > "Bob Barrows [MVP]" <reb01501@NOyah oo.SPAMcom> wrote in message
            > news:OWxgJ9qlEH A.2224@tk2msftn gp13.phx.gbl...[color=green]
            >> JT wrote:[color=darkred]
            >> > im trying to use the following code to log whenever a user clicks
            >> > through this particlular message box - however, this currently logs
            >> > regardless of whether or not the message box was clicked - im
            >> > assuming this is because the server-side code can't see the client
            >> > side if condition. but how can i set the varMsgBox variable as a
            >> > server-side variable?
            >> >[/color]
            >> You can't. All server-side code runs before client-side code is
            >> processed.
            >>
            >>
            >> --
            >> Microsoft MVP -- ASP/ASP.NET
            >> Please reply to the newsgroup. The email account listed in my From
            >> header is my spam trap, so I don't check it very often. You will get a
            >> quicker response by posting to the newsgroup.
            >>
            >>[/color]
            >
            >[/color]


            Comment

            Working...