shop cart list page with several remove buttons, no javascript

Discussion in 'ASP General' started by wolfing1@gmail.com, Jun 16, 2006.

  1. Guest

    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)
    , Jun 16, 2006
    #1
    1. Advertising

  2. 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?


    <> wrote in message
    news:...
    > 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], Jun 16, 2006
    #2
    1. Advertising

  3. Mike Brind Guest

    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.asp">
    <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
    Mike Brind, Jun 16, 2006
    #3
  4. Guest

    Mike Brind wrote:
    > 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.asp">
    > <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

    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?
    , Jun 18, 2006
    #4
  5. Mike Brind Guest

    wrote:
    > Mike Brind wrote:
    > > 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.asp">
    > > <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

    > 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?


    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.asp">
    <input type="hidden" name ="cartitem" value="<%=cart_item_value%">
    <input type="submit" name="action" value="Delete">
    </form>

    If Request.Form("action") = "Delete" Then
    Remove item from cart where cart_item_id = Request.Form("cartitme")

    --
    Mike Brind
    Mike Brind, Jun 18, 2006
    #5
  6. <> wrote in message
    news:...
    >
    > Mike Brind wrote:
    >> 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.asp">
    >> <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

    > 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?


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

    A
    Aaron Bertrand [SQL Server MVP], Jun 18, 2006
    #6
  7. Guest

    Aaron Bertrand [SQL Server MVP] wrote:
    > <> wrote in message
    > news:...
    > >
    > > Mike Brind wrote:
    > >> 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.asp">
    > >> <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

    > > 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?

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

    Oh so each item would be a form in itself? hmm... oh hey that's pretty
    cool, let me try that thanks!
    , Jun 19, 2006
    #7
    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. Konrad

    virtual shop

    Konrad, Jul 16, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    464
    Yan-Hong Huang[MSFT]
    Jul 17, 2003
  2. John Dalberg
    Replies:
    2
    Views:
    1,211
    John Dalberg
    Feb 28, 2006
  3. Kees de Winter
    Replies:
    8
    Views:
    313
    Edwin Knoppert
    Dec 12, 2006
  4. Victor \Zverok\ Shepelev

    RDOC: several related modules in several C files

    Victor \Zverok\ Shepelev, Mar 6, 2007, in forum: Ruby
    Replies:
    3
    Views:
    181
    Max Lapshin
    Mar 16, 2007
  5. Otto Wyss

    Several submit buttons in a form

    Otto Wyss, Feb 13, 2007, in forum: Javascript
    Replies:
    2
    Views:
    78
    Randy Webb
    Feb 13, 2007
Loading...

Share This Page