Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Posts
    233

    Unanswered: Set qry string value based on radio btn selected

    I have a page that i need to sort if the user selects the sort radio btn and then hit the link to reload the page.

    I want to pass a 1 in the querystring for sort if the rb is checked and no querystring if the rb isnt checked.

    How can i do this?
    also once the rb is selected when i click it a second time it doesnt unselect

    I just inherited a classic asp site and have 1 week experiance so all the help u can give apreciated

    Thanks!
    <%@ Language=VBScript %>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title></title>
    </head>
    <body>
    <%
    dim sort, strSQL
    sort=Request.QueryString("sort")

    if sort=1 then
    strSQL = strSQL & "ORDER BY Date Desc"
    else
    strSQL = strSQL & "ORDER BY fName"
    end if
    %>

    <div id="SelFra" style="POSITION: absolute; WIDTH: 100%;">
    <table width ="100%" border="0" cellspacing="0" align="center" >
    <tr bgcolor="#aeaeae" >
    <td style="width:200px;">&nbsp;&nbsp;
    <input type="radio" name="rbSort" value="0"
    <% IF sort=1 then Response.Write "Checked" end if %> />&nbsp;&nbsp;Sort by Account Size&nbsp;&nbsp;
    </td>
    <td>
    <a href="Default22.asp?sort=1" >Image</a>
    </td>
    </tr>
    </table>
    </div>
    </body>
    </html>

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You're trying to use a hammer on a screw here...

    You can define the value of ANY <input /> element present on an HTML form. If you don't understand how the <input /> element works, then I highly suggest you drop everything you're trying to do and take a few tutorials. It will save you an immense amount of pain in the very near future. w3schools.com is always good one for starters:

    HTML Tutorial
    ASP Tutorial

    As far as preventing the user from deselecting a given control, this would fall in to the realm of javascript, which you can use to toggle the "enabled" property of a given element:

    JavaScript Tutorial


    btw, don't expect to pick all of this up in a week...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Oct 2003
    Posts
    233
    I have read through asp 3.0 for beginners, its just that every time i do something my brain keeps going back to asp.net

    also i dont want to restrict the selection but did figure out the issue that i only had 1 radio button.

    I really dont want to start re reading a book until i get to the point that it answers my question, I will only be on asp as long as it takes me to redo the site in dot net so i really dont want to study asp 30 more than i have to

    so if anyone could give me a boost so to say i would appreciate it

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Are you already fluent in ASP.NET? That will help a good deal for explaining things...

    This is more of a basic html question than ASP. Even with .NET, it is important to understand what makes an ASP.NET page tick since ASP.NET is ultimately emitting html/css/javascript. If you don't take the time to understand what it's emitting or why, you are again setting yourself up for frustration.

    To more directly answer your question, you should be wrapping your input controls in a form. By specifying the target and type of form, you can control where the page posts back and whether it will use GET (querystring) or POST (post variables) to transmit the values of the elements inside the form. Using this technique, you can simply set the value of each <radio /> to your liking. Regardless of whether you use POST or GET, you can access the variables by way of the Request.Form collection (Request.Params in .NET):

    HTML Forms and Input

    Understanding how forms work will also GREATLY aid your ASP.NET endeavors as the entire platform revolves around handling input from forms. This is how things such as viewstate and server controls function under the hood...
    Last edited by Teddy; 03-21-10 at 14:54.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •