Select OnAction in ASP?

Discussion in 'ASP General' started by Johan Christensson, Sep 29, 2004.

  1. Hi.

    I'm woundering if it's possibel to transfer a OnAction value from a
    drop-down box in an ASP page without having to use Java code?

    I mean something like this:

    <%

    Sub resposeprocess
    some code,......
    End Sub

    %>

    <Select name="DropDownMenu onAction="responseprocess">
    <Option value="1">Value 1</option>
    <Option value="2">Value 2</option>
    </Select>

    Can i get holds of the value from the drop-down box and use it inte the
    subroutibe?

    /Johan Ch
     
    Johan Christensson, Sep 29, 2004
    #1
    1. Advertising

  2. No, not really. See, with the way ASP works, there is no "built-in" way to
    interact between client and server. How things work is:


    1. Browser enters URL, which in turn sends an http request to a server.
    2. Server receives request, loads the page, runs any ASP code that may be
    in it.
    3. After all the code is run or a Response.End is reached, the resultant
    HTML is sent back to the client (browser) that made the request.

    So, you see, by the time your onAction (what's that?) event happens, there
    is no server sitting there connected to the browser waiting for a subroutine
    call. You have to have the browser make another request to the server. For
    example:



    <%
    If Request.Querystring("choice") <> "" Then Call resposeprocess()
    Sub resposeprocess()
    ''some code
    Response.Write "Sub routine ran."
    Response.Write "<br>Option chosen: " & Request.Querystring("choice")
    End Sub
    %>

    <select name="DropDownMenu"
    onchange="location.href='thispage.asp?choice='+this.value;">
    <option value="1">Value 1</option>
    <option value="2">Value 2</option>
    </select

    So, that's using JavaSCRIPT, which you didn't want to do, but you either
    have to use that or encapsulate this in a form with a submit button that the
    user will have to click on to send the new request to the server.

    Ray at home

    "Johan Christensson" <> wrote in message
    news:...
    > Hi.
    >
    > I'm woundering if it's possibel to transfer a OnAction value from a
    > drop-down box in an ASP page without having to use Java code?
    >
    > I mean something like this:
    >
    > <%
    >
    > Sub resposeprocess
    > some code,......
    > End Sub
    >
    > %>
    >
    > <Select name="DropDownMenu onAction="responseprocess">
    > <Option value="1">Value 1</option>
    > <Option value="2">Value 2</option>
    > </Select>
    >
    > Can i get holds of the value from the drop-down box and use it inte the
    > subroutibe?
    >
    > /Johan Ch
    >
     
    Ray Costanzo [MVP], Sep 29, 2004
    #2
    1. Advertising

  3. Johan Christensson

    Jeff Cochran Guest

    On Wed, 29 Sep 2004 02:20:18 +0200, "Johan Christensson"
    <> wrote:

    >I'm woundering if it's possibel to transfer a OnAction value from a
    >drop-down box in an ASP page without having to use Java code?


    Sure. It could be JavaScript, ActiveX or anything else tht will
    operate on the client side. :)

    >I mean something like this:
    >
    ><%
    >
    >Sub resposeprocess
    > some code,......
    >End Sub
    >
    >%>
    >
    ><Select name="DropDownMenu onAction="responseprocess">
    ><Option value="1">Value 1</option>
    ><Option value="2">Value 2</option>
    ></Select>
    >
    >Can i get holds of the value from the drop-down box and use it inte the
    >subroutibe?


    No. The ASP page is processed and sent to the client. Then the
    client changes something. The ASP is done, so the client has to
    trigger sending something to the server. Which means some type of
    client side code, be it Java, JavaScript, ActiveX or a "Submit"
    button.

    Jeff
     
    Jeff Cochran, Sep 29, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGFiYmxlcg==?=

    select gridview row without using select button?

    =?Utf-8?B?RGFiYmxlcg==?=, Mar 3, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    101,562
    dch31969
    Feb 27, 2009
  2. J. Hall
    Replies:
    2
    Views:
    1,089
    Jeff Thies
    Apr 21, 2004
  3. jas

    select.select() on windows

    jas, Oct 25, 2005, in forum: Python
    Replies:
    4
    Views:
    801
    Maksim Kasimov
    Oct 27, 2005
  4. Laszlo Nagy

    select.select and socket.setblocking

    Laszlo Nagy, Dec 30, 2008, in forum: Python
    Replies:
    12
    Views:
    1,203
    Roy Smith
    Jan 3, 2009
  5. palmiere
    Replies:
    1
    Views:
    431
    Erwin Moller
    Feb 9, 2004
Loading...

Share This Page