Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dynamic checkboxes!

    I am working on a webform and would like to implement the following:

    When a user selects (checks) a checkbox, a window should popup to display further options. Both the data in the parent window and the child window need to submit to a database. I know you can use javascript to make pop-ups but so far I haven't seen how to do this on clicking a checkbox. people seem to use buttons and hyperlinks instead. I'd like to make the system a bit slicker than, say, having a page of choices, a submit button and one page after another for the data to be selected for each checkbox. A pop-up would be better in terms of user experience.

    ASP classic, FrontPage, IIS.

    TIA
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20>

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Dynamic checkboxes!

    In your form, maybe something like this?
    <pre><html>
    <head>
    <title>Checkbox script demo</title>
    <script>
    function setOpts(strID, strURL)
    {
    var myChkbox = document.getElementById(strID);
    if (myChkbox.checked == true) {
    // open new window
    window.open(strURL);
    }
    else {
    // need to clear anything?
    }
    }
    </script>
    </head>
    <body>
    <h3>Checkbox script demo</h3>
    <form>
    <input id="chk01" type="checkbox" onClick="setOpts('chk01', 'setoptions.asp?id=chk01');">Hawaii
    <input id="chk02" type="checkbox" onClick="setOpts('chk02', 'setoptions.asp?id=chk02');">Mexico
    </form>
    </body>
    </html></pre>

    In your pop-up, to re-submit the data to your form:

    <img src=/S/blackteeth.gif border=0 alt=blackteeth width=20 height=20> This part isn't so obvious to me.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dynamic checkboxes!

    What I've decided to do is forgo the checkboxes and just use a hyperlink to pop-ups for each choice. I originally designed the db to capture whether a category was selected on a table and then capture what details for each selection were selected in another table. I don't think it's strictly necessary to capture the primary selection (root category for details) as you can derive that by noting whether any data for a particular category was selected in the first place. So I will probably be able to delete a table from the db...

    as to how the pop-ups submit to the db, currently they do that directly. the only items on these pop-ups is a series of checkboxes and, in some cases, a text box. the logic behind the web form project is that the user, on submitting preliminary required info to the db is assigned a unique ID and this ID is tied to all subsequent form submissions. I haven't gotten into the issue of server-side validation yet but I believe the pop-ups can submit to themselves so I'm not terribly worried about it right now. I'm in the base design phase at the moment, to get a basic system setup. Things will likely change *a lot* before this puppy is done...

Posting Permissions

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