checkbox - Querystring

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

    checkbox - Querystring

    I have an asp page populated by a sql database. I am using stored procs
    with Dreamweaver. I know very little Javascript but think that it will help
    me in this case.

    I am using a repeating table to show all records that meet a certain
    criteria from SQL. I have placed a checkbox next to each record. I have
    enclosed the repeating table in a form. I want the user to be able to check
    one or more of the checkboxes and then click the submit button on the form.

    I want the form to submit to another pahe that runs a SQL command to update
    the database. In order to do this I need a specific field (entry) to be
    passed as a querystring to the update page. I have set the name of the
    repeating checkbox to the corresponding "entry" value of each record.

    I hope I am explaining this the right way. Any help would be appreciated.
    Thanks!

    Darren


  • Joakim Braun

    #2
    Re: checkbox - Querystring

    "Darren" <darren@lan-specialist.com> skrev i meddelandet
    news:TgAIc.3349 5$Xb4.11428@nwr dny02.gnilink.n et...[color=blue]
    > I have an asp page populated by a sql database. I am using stored procs
    > with Dreamweaver. I know very little Javascript but think that it will[/color]
    help[color=blue]
    > me in this case.
    >
    > I am using a repeating table to show all records that meet a certain
    > criteria from SQL. I have placed a checkbox next to each record. I have
    > enclosed the repeating table in a form. I want the user to be able to[/color]
    check[color=blue]
    > one or more of the checkboxes and then click the submit button on the[/color]
    form.[color=blue]
    >
    > I want the form to submit to another pahe that runs a SQL command to[/color]
    update[color=blue]
    > the database. In order to do this I need a specific field (entry) to be
    > passed as a querystring to the update page. I have set the name of the
    > repeating checkbox to the corresponding "entry" value of each record.
    >
    > I hope I am explaining this the right way. Any help would be appreciated.
    > Thanks!
    >
    > Darren[/color]

    If a unique id/primary key or something like that becomes the name of the
    checkbox, make sure the name is legal HTML for form element names. For
    instance, the name can't start with a digit.

    Or what exactly is your question?

    Joakim Braun


    Comment

    • Darren

      #3
      Re: checkbox - Querystring

      How do I use a checkbox to send a value through a Querystring to another
      page?

      Basically I am trying to delete records from a table by selecting the
      checkboxes and then clicking delete. I can get it to work checking one
      checkbox but not with multiple.

      "Joakim Braun" <joakim.braun@j fbraun.removeth is.com> wrote in message
      news:zTAIc.3619 $Z57.2201@nntps erver.swip.net. ..[color=blue]
      > "Darren" <darren@lan-specialist.com> skrev i meddelandet
      > news:TgAIc.3349 5$Xb4.11428@nwr dny02.gnilink.n et...[color=green]
      > > I have an asp page populated by a sql database. I am using stored procs
      > > with Dreamweaver. I know very little Javascript but think that it will[/color]
      > help[color=green]
      > > me in this case.
      > >
      > > I am using a repeating table to show all records that meet a certain
      > > criteria from SQL. I have placed a checkbox next to each record. I[/color][/color]
      have[color=blue][color=green]
      > > enclosed the repeating table in a form. I want the user to be able to[/color]
      > check[color=green]
      > > one or more of the checkboxes and then click the submit button on the[/color]
      > form.[color=green]
      > >
      > > I want the form to submit to another pahe that runs a SQL command to[/color]
      > update[color=green]
      > > the database. In order to do this I need a specific field (entry) to be
      > > passed as a querystring to the update page. I have set the name of the
      > > repeating checkbox to the corresponding "entry" value of each record.
      > >
      > > I hope I am explaining this the right way. Any help would be[/color][/color]
      appreciated.[color=blue][color=green]
      > > Thanks!
      > >
      > > Darren[/color]
      >
      > If a unique id/primary key or something like that becomes the name of the
      > checkbox, make sure the name is legal HTML for form element names. For
      > instance, the name can't start with a digit.
      >
      > Or what exactly is your question?
      >
      > Joakim Braun
      >
      >[/color]


      Comment

      • kaeli

        #4
        Re: checkbox - Querystring

        In article <eUBIc.17976$Al 5.9061@nwrdny03 .gnilink.net>, darren@lan-
        specialist.com enlightened us with...[color=blue]
        > How do I use a checkbox to send a value through a Querystring to another
        > page?
        >
        > Basically I am trying to delete records from a table by selecting the
        > checkboxes and then clicking delete. I can get it to work checking one
        > checkbox but not with multiple.
        >[/color]

        This should be done server-side with ASP, not with client-side
        javascript. Are you using JScript? If not, ask this question in an ASP
        group that uses VBScript.

        And you should NOT be using the querystring to delete records. Too easy
        for the user to mess up when refreshing the page and whatnot. Always use
        POST for things that affect the DB. GET is for queries.

        Verify that your question pertains to server-side JScript and elaborate
        and I might be able to help you.

        --
        --
        ~kaeli~
        When two egotists meet, it's an I for an I.



        Comment

        • Joakim Braun

          #5
          Re: checkbox - Querystring

          "Darren" <darren@lan-specialist.com> skrev i meddelandet
          news:eUBIc.1797 6$Al5.9061@nwrd ny03.gnilink.ne t...[color=blue]
          > How do I use a checkbox to send a value through a Querystring to another
          > page?
          >
          > Basically I am trying to delete records from a table by selecting the
          > checkboxes and then clicking delete. I can get it to work checking one
          > checkbox but not with multiple.[/color]

          If the checkboxes are all in the same form, all you should have to do is
          submit it with GET (or POST) to some server-side script that walks the
          possible range of checkbox names, or figures out what to delete in some
          other appropriate way.

          Say you have a form like this:

          <form method="get" action="thing.h tm" name="someform" >
          <input type="checkbox" name="uniqueid1 " value="1">
          <input type="checkbox" name="uniqueid2 " value="1">
          <input type="submit" name="Submit" value="Submit">
          </form>

          Check the checkboxes, submit and the resulting URL looks like this:
          http://...someplace.../thing.htm?uni...&Submit=Submit

          Unchecked or unnamed checkboxes are not submitted. Whatever server-side
          technology you use will have some convenient way to retrieve those GET
          request variables. Of course, the query string is equally accessible with
          client-side javascript.

          Joakim Braun


          Comment

          • Joakim Braun

            #6
            Re: checkbox - Querystring

            Forgot to add: To try out your form, you'll need to connect through http.
            You won't get any query string if you go through "local file viewing
            mechanisms" (on IE in Windows XP at least).

            Joakim Braun


            Comment

            Working...