Loosing Session Values from script to script

Discussion in 'ASP General' started by Mirovk, Aug 22, 2006.

  1. Mirovk

    Mirovk Guest

    The onclick action associated to my form´s radio buttons call to a
    vbscript were the session values are changed, this happens correctly
    but with the onclick action associated to my continue button always
    shows the value =1 instead the values selected under my radio buttons
    (Values= 4,3 or 1)

    I am showing the code.

    Ideas welcome.

    Thanks....

    1.- Radio Buttons:
    <td width="58%" class="titulos2"><input type="radio" checked
    name="btn_tipo_pago" value="3" >
    <td width="58%" class="titulos2"><input type="radio" unchecked
    name="btn_tipo_pago" value="4">
    <tr><td class="titulos2"><input type="radio" unchecked
    name="btn_tipo_pago" value="1" >

    2.- Script for handling onclick event (shows the correct values
    assigned at the radio button):

    <SCRIPT FOR="btn_tipo_pago" EVENT="onclick" LANGUAGE="VBScript">
    Dim oElement, oElements, oRadio
    Dim sValue
    set oElements = Document.frmdir.Elements
    for each oElement in oElements
    if oElement.Type= "radio" and oElement.Checked = True then
    set oRadio = oElement
    Exit for
    End if
    next
    sValue = oRadio.value
    ************ IN sValue THERE IS THE VALUE OF THE RADIO BUTTON SELECTED
    *************
    if sValue=3 then
    <%chk_pago=3%>
    alert <%=chk_pago%>
    <%session("tipo_pago") = chk_pago%>
    alert("<%=Session("tipo_pago")%>")
    else
    if sValue=4 then
    <%chk_pago=4%>
    alert <%=chk_pago%>
    <%session("tipo_pago") = chk_pago%>
    alert("<%=Session("tipo_pago")%>")
    else
    if sValue=1 then
    <%chk_pago=1%>
    alert <%=chk_pago%>
    <%session("tipo_pago") = chk_pago%>
    alert("<%=Session("tipo_pago")%>")
    else
    alert "Error"
    end if
    end if
    end if
    </script>

    3.- Continue button:
    <a name="continuar" class="normal_sub" style="cursor:hand;">Finalizar
    Compra</a>

    4.- Script to check if the values assigned were correct (it´s
    suppoused becase were show correctly on the last script, but it´s not
    because always shows the "1" as value for both variable)

    <SCRIPT FOR="continuar" EVENT="onclick" LANGUAGE="VBScript">
    alert <%=chk_pago%>
    alert("<%=Session("tipo_pago")%>")
    </script>
    Mirovk, Aug 22, 2006
    #1
    1. Advertising

  2. Mirovk

    Evertjan. Guest

    Mirovk wrote on 22 aug 2006 in microsoft.public.inetserver.asp.general:

    > The onclick action associated to my formïs radio buttons call to a
    > vbscript were the session values are changed, this happens correctly
    > but with the onclick action associated to my continue button always
    > shows the value =1 instead the values selected under my radio buttons
    > (Values= 4,3 or 1)

    [....]
    >
    > <SCRIPT FOR="btn_tipo_pago" EVENT="onclick" LANGUAGE="VBScript">
    >


    Wait a minute - you're talking .NET aren't you?

    This is a classic asp newsgroup. ASP.NET is totally different.

    Try over at microsoft.public.dotnet.framework.aspnet.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Aug 22, 2006
    #2
    1. Advertising

  3. Mirovk

    Mirovk Guest

    Hi,
    Yes this is classic ASP not .NET
    If you can help me I will appreciatte.
    Thanks,
    Javier


    Evertjan. ha escrito:

    > Mirovk wrote on 22 aug 2006 in microsoft.public.inetserver.asp.general:
    >
    > > The onclick action associated to my formïs radio buttons call to a
    > > vbscript were the session values are changed, this happens correctly
    > > but with the onclick action associated to my continue button always
    > > shows the value =1 instead the values selected under my radio buttons
    > > (Values= 4,3 or 1)

    > [....]
    > >
    > > <SCRIPT FOR="btn_tipo_pago" EVENT="onclick" LANGUAGE="VBScript">
    > >

    >
    > Wait a minute - you're talking .NET aren't you?
    >
    > This is a classic asp newsgroup. ASP.NET is totally different.
    >
    > Try over at microsoft.public.dotnet.framework.aspnet.
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
    Mirovk, Aug 22, 2006
    #3
  4. Mirovk

    Evertjan. Guest

    Mirovk wrote on 22 aug 2006 in microsoft.public.inetserver.asp.general:
    > Evertjan. ha escrito:
    >
    >> Mirovk wrote on 22 aug 2006 in
    >> microsoft.public.inetserver.asp.general:
    >>
    >> > The onclick action associated to my formïs radio buttons call to a
    >> > vbscript were the session values are changed, this happens
    >> > correctly but with the onclick action associated to my continue
    >> > button always shows the value =1 instead the values selected under
    >> > my radio buttons (Values= 4,3 or 1)

    >> [....]
    >> >
    >> > <SCRIPT FOR="btn_tipo_pago" EVENT="onclick" LANGUAGE="VBScript">
    >> >

    >>
    >> Wait a minute - you're talking .NET aren't you?


    [please do not toppost on usenet]

    > Yes this is classic ASP not .NET


    I doubt that. If so it does not work that way.

    With classical ASP

    if sValue=3 then
    <%session("tipo_pago") = 3 %>
    else
    if sValue=4 then
    <%session("tipo_pago") = 4 %>

    an onclick [clientside!] action cannot do a serverside action,
    like changing a session variable's value.

    >> This is a classic asp newsgroup. ASP.NET is totally different.
    >>
    >> Try over at microsoft.public.dotnet.framework.aspnet.


    > If you can help me I will appreciatte.


    Setting a session variable as a result of an onclick needs a trip to the
    server, usually by submitting a <form>, [but could be don by AJAX, etc.]

    I even doubt you can do the above in asp.net,
    but that is not my experise,
    and off-topic in this NG.

    [btw: vbscript has "elseif",
    which would help you simplifying your code,
    by getting rid of the multiple "end if"s.]

    [btw: clientside vbscript works only on IE.]

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Aug 22, 2006
    #4
  5. Mirovk wrote:
    > sValue = oRadio.value
    > ************ IN sValue THERE IS THE VALUE OF THE RADIO BUTTON SELECTED
    > *************
    > if sValue=3 then
    > <%chk_pago=3%>
    > alert <%=chk_pago%>
    > <%session("tipo_pago") = chk_pago%>
    > alert("<%=Session("tipo_pago")%>")
    > else
    > if sValue=4 then


    ASP is stateless (all web technologoes are, for that matter):
    http://en.wikipedia.org/wiki/Stateless_server

    The server has no knowledge of client-side variables, and the client has no
    knowledge of server-side variables. Those variables don't even exist at the
    same time.

    If you want to pass data from the client to the server, you must package it
    into a request. The data can be carried in the querystring or in the request
    headers (cookies or form POSTs).

    To get data from the server to the client, you must write a complete
    document that contains the data in a format that allows extraction.



    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms.
    Dave Anderson, Aug 22, 2006
    #5
  6. Mirovk

    Mirovk Guest

    Dave,
    Thank you very much for your comments.
    Mirovk, Aug 22, 2006
    #6
    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. Jonk Eidersteldvr

    Session Variables - Loosing

    Jonk Eidersteldvr, Aug 29, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    516
    Mark MacRae
    Aug 29, 2003
  2. =?Utf-8?B?V2luZGphbW1lcg==?=

    Loosing Session values across Applications

    =?Utf-8?B?V2luZGphbW1lcg==?=, Feb 17, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    382
    =?Utf-8?B?QW51cmFkaGE=?=
    Feb 17, 2004
  3. Ziyad Makki
    Replies:
    0
    Views:
    314
    Ziyad Makki
    Aug 2, 2004
  4. Mark Norgate

    Loosing property values; and design time rendering

    Mark Norgate, Aug 24, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    109
    Mark Norgate
    Aug 24, 2003
  5. Mark Norgate

    Properties loosing their values, and TagPrefix

    Mark Norgate, Sep 1, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    128
    Mark Norgate
    Sep 1, 2003
Loading...

Share This Page