shop cart list page with several remove buttons, no javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • wolfing1@gmail.com

    shop cart list page with several remove buttons, no javascript

    how would I go doing it without javascript and using 'POST'?
    Having a page with a variable list of items in a shopcart, each item
    with its own 'remove' button. How could I do this without a javascript
    and using POST as the form type? (so having <a href="page.htm? remove=2>
    is not possible)

  • Aaron Bertrand [SQL Server MVP]

    #2
    Re: shop cart list page with several remove buttons, no javascript

    You have a shopping cart, what is the justification for no javascript?

    Do you really think there are people out there who would give you their
    credit card number but wouldn't trust you to popup a window or an alert
    message using JavaScript?


    <wolfing1@gmail .com> wrote in message
    news:1150474496 .314353.105260@ y41g2000cwy.goo glegroups.com.. .[color=blue]
    > how would I go doing it without javascript and using 'POST'?
    > Having a page with a variable list of items in a shopcart, each item
    > with its own 'remove' button. How could I do this without a javascript
    > and using POST as the form type? (so having <a href="page.htm? remove=2>
    > is not possible)
    >[/color]


    Comment

    • Mike Brind

      #3
      Re: shop cart list page with several remove buttons, no javascript


      wolfi...@gmail. com wrote:[color=blue]
      > how would I go doing it without javascript and using 'POST'?
      > Having a page with a variable list of items in a shopcart, each item
      > with its own 'remove' button. How could I do this without a javascript
      > and using POST as the form type? (so having <a href="page.htm? remove=2>
      > is not possible)[/color]

      <form method="post" action="delete_ an_entry_page.a sp">
      <input type="hidden" value="<%=cart_ item_value%">
      <input type="submit" name="action" value="Delete">
      </form>

      Or am I missing something tricky in your question?

      --
      Mike Brind

      Comment

      • wolfing1@gmail.com

        #4
        Re: shop cart list page with several remove buttons, no javascript


        Mike Brind wrote:[color=blue]
        > wolfi...@gmail. com wrote:[color=green]
        > > how would I go doing it without javascript and using 'POST'?
        > > Having a page with a variable list of items in a shopcart, each item
        > > with its own 'remove' button. How could I do this without a javascript
        > > and using POST as the form type? (so having <a href="page.htm? remove=2>
        > > is not possible)[/color]
        >
        > <form method="post" action="delete_ an_entry_page.a sp">
        > <input type="hidden" value="<%=cart_ item_value%">
        > <input type="submit" name="action" value="Delete">
        > </form>
        >
        > Or am I missing something tricky in your question?
        >
        > --
        > Mike Brind[/color]
        The thing is, there are several (variable number of) 'delete' buttons,
        one for each item. How would the page know which one of them was
        clicked?
        Like, if I knew there would be, say, 10 buttons, I could name them all
        button1, button2, etc. and in the asp page I could ask for button1.x.
        But if I don't know how many items would there be in the page in
        advance, how would I do that?

        Comment

        • Mike Brind

          #5
          Re: shop cart list page with several remove buttons, no javascript


          wolfing1@gmail. com wrote:[color=blue]
          > Mike Brind wrote:[color=green]
          > > wolfi...@gmail. com wrote:[color=darkred]
          > > > how would I go doing it without javascript and using 'POST'?
          > > > Having a page with a variable list of items in a shopcart, each item
          > > > with its own 'remove' button. How could I do this without a javascript
          > > > and using POST as the form type? (so having <a href="page.htm? remove=2>
          > > > is not possible)[/color]
          > >
          > > <form method="post" action="delete_ an_entry_page.a sp">
          > > <input type="hidden" value="<%=cart_ item_value%">
          > > <input type="submit" name="action" value="Delete">
          > > </form>
          > >
          > > Or am I missing something tricky in your question?
          > >
          > > --
          > > Mike Brind[/color]
          > The thing is, there are several (variable number of) 'delete' buttons,
          > one for each item. How would the page know which one of them was
          > clicked?
          > Like, if I knew there would be, say, 10 buttons, I could name them all
          > button1, button2, etc. and in the asp page I could ask for button1.x.
          > But if I don't know how many items would there be in the page in
          > advance, how would I do that?[/color]

          You can tell which one was clicked from the value passed in the hidden
          field. Although to make it work, you would have to give the hidden
          field a name - something I neglected to do :-)

          <form method="post" action="delete_ an_entry_page.a sp">
          <input type="hidden" name ="cartitem" value="<%=cart_ item_value%">
          <input type="submit" name="action" value="Delete">
          </form>

          If Request.Form("a ction") = "Delete" Then
          Remove item from cart where cart_item_id = Request.Form("c artitme")

          --
          Mike Brind

          Comment

          • Aaron Bertrand [SQL Server MVP]

            #6
            Re: shop cart list page with several remove buttons, no javascript


            <wolfing1@gmail .com> wrote in message
            news:1150650409 .156468.116520@ g10g2000cwb.goo glegroups.com.. .[color=blue]
            >
            > Mike Brind wrote:[color=green]
            >> wolfi...@gmail. com wrote:[color=darkred]
            >> > how would I go doing it without javascript and using 'POST'?
            >> > Having a page with a variable list of items in a shopcart, each item
            >> > with its own 'remove' button. How could I do this without a javascript
            >> > and using POST as the form type? (so having <a href="page.htm? remove=2>
            >> > is not possible)[/color]
            >>
            >> <form method="post" action="delete_ an_entry_page.a sp">
            >> <input type="hidden" value="<%=cart_ item_value%">
            >> <input type="submit" name="action" value="Delete">
            >> </form>
            >>
            >> Or am I missing something tricky in your question?
            >>
            >> --
            >> Mike Brind[/color]
            > The thing is, there are several (variable number of) 'delete' buttons,
            > one for each item. How would the page know which one of them was
            > clicked?[/color]

            Because there is a form for each button, and an <input type=hidden
            name=productid value="<%=produ ctid%>">

            A


            Comment

            • wolfing1@gmail.com

              #7
              Re: shop cart list page with several remove buttons, no javascript


              Aaron Bertrand [SQL Server MVP] wrote:[color=blue]
              > <wolfing1@gmail .com> wrote in message
              > news:1150650409 .156468.116520@ g10g2000cwb.goo glegroups.com.. .[color=green]
              > >
              > > Mike Brind wrote:[color=darkred]
              > >> wolfi...@gmail. com wrote:
              > >> > how would I go doing it without javascript and using 'POST'?
              > >> > Having a page with a variable list of items in a shopcart, each item
              > >> > with its own 'remove' button. How could I do this without a javascript
              > >> > and using POST as the form type? (so having <a href="page.htm? remove=2>
              > >> > is not possible)
              > >>
              > >> <form method="post" action="delete_ an_entry_page.a sp">
              > >> <input type="hidden" value="<%=cart_ item_value%">
              > >> <input type="submit" name="action" value="Delete">
              > >> </form>
              > >>
              > >> Or am I missing something tricky in your question?
              > >>
              > >> --
              > >> Mike Brind[/color]
              > > The thing is, there are several (variable number of) 'delete' buttons,
              > > one for each item. How would the page know which one of them was
              > > clicked?[/color]
              >
              > Because there is a form for each button, and an <input type=hidden
              > name=productid value="<%=produ ctid%>">
              >[/color]
              Oh so each item would be a form in itself? hmm... oh hey that's pretty
              cool, let me try that thanks!

              Comment

              Working...