more submit buttons?

Discussion in 'HTML' started by roN, Aug 16, 2005.

  1. roN

    roN Guest

    Hi,
    I show the content of a MySQL Table in a select box.
    Below the select box is a text field.
    I want to add the text that is clicked in the select to the text field. how
    do I do that?
    and then I want to be able to have two buttons: 'Add' and 'Remove' to add an
    entry to the table or remove the one that is written in the text field. how
    would I do that?
    Thank you!

    --
    chEErs roN
    I'm root. I'm allowed to do this! ;)
    keep on rockin'
     
    roN, Aug 16, 2005
    #1
    1. Advertising

  2. "roN" <> wrote:

    > I show the content of a MySQL Table in a select box.
    > Below the select box is a text field.
    > I want to add the text that is clicked in the select to the text field.
    > how do I do that?


    You can't do that in HTML. You might be able to do that using your favorite
    scripting language, client-side or server-side. But what has this got to do
    with more submit buttons?

    > and then I want to be able to have two buttons: 'Add' and 'Remove' to
    > add an entry to the table or remove the one that is written in the text
    > field. how would I do that?


    Multiple submit buttons work unreliably if a form contains a text input
    field, since hitting Enter in that field may trigger form submission as if
    one of the buttons had been used - and that button could be the 'Add'
    button on odd days, the 'Remove' button on even days.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Aug 16, 2005
    #2
    1. Advertising

  3. roN

    roN Guest

    Jukka K. Korpela wrote:
    > "roN" <> wrote:
    >
    >> I show the content of a MySQL Table in a select box.
    >> Below the select box is a text field.
    >> I want to add the text that is clicked in the select to the text
    >> field. how do I do that?

    >
    > You can't do that in HTML. You might be able to do that using your
    > favorite scripting language, client-side or server-side. But what has
    > this got to do with more submit buttons?


    Yes, I think I'll do that in Javascript. It's even faster than any
    server-side language...

    >> and then I want to be able to have two buttons: 'Add' and 'Remove' to
    >> add an entry to the table or remove the one that is written in the
    >> text field. how would I do that?

    >
    > Multiple submit buttons work unreliably if a form contains a text
    > input field, since hitting Enter in that field may trigger form
    > submission as if one of the buttons had been used - and that button
    > could be the 'Add' button on odd days, the 'Remove' button on even
    > days.


    So how would you solve this problem?
    Thank you for suggestions!

    --
    chEErs roN
    I'm root. I'm allowed to do this! ;)
    keep on rockin'
     
    roN, Aug 17, 2005
    #3
  4. roN

    Adrienne Guest

    Gazing into my crystal ball I observed "roN" <> writing
    in news::

    > Jukka K. Korpela wrote:
    >> "roN" <> wrote:
    >>
    >>> I show the content of a MySQL Table in a select box.
    >>> Below the select box is a text field.
    >>> I want to add the text that is clicked in the select to the text
    >>> field. how do I do that?

    >>
    >> You can't do that in HTML. You might be able to do that using your
    >> favorite scripting language, client-side or server-side. But what has
    >> this got to do with more submit buttons?

    >
    > Yes, I think I'll do that in Javascript. It's even faster than any
    > server-side language...
    >


    What about users without javascript? What about SQL injection? You HAVE to
    check serverside to make sure someone isn't doing something bad.

    >>> and then I want to be able to have two buttons: 'Add' and 'Remove' to
    >>> add an entry to the table or remove the one that is written in the
    >>> text field. how would I do that?

    >>
    >> Multiple submit buttons work unreliably if a form contains a text
    >> input field, since hitting Enter in that field may trigger form
    >> submission as if one of the buttons had been used - and that button
    >> could be the 'Add' button on odd days, the 'Remove' button on even
    >> days.

    >
    > So how would you solve this problem?
    > Thank you for suggestions!


    You test for the value of each submit button.
    <input type="submit" value="Add" name="add">
    <input type="submit" value="Delete" name="delete">

    Depending on which one, you confirm to the user before committing the
    change. You could do the confirm with javascript or server side. Here's a
    simple example in ASP:

    <% dim add, delete, confirm, isadd, isdelete, isconfirmed, confirmadd,
    confirmdelete

    if not isconfirmed then
    if request.form("add") = "add" then
    isadd = true
    isconfirmed = true
    elseif request.form("delete") = "delete" then
    isdelete = true
    isconfirmed = true
    end if
    else
    if request.form("confirm") = "Confirm Addition" then
    'do your insert
    elseif request.form("confirm") = "Confirm Deletion" then
    'do you delete
    else
    'throw an error
    end if
    end if
    %>
    <% if not isconfirmed then %>
    <form method="post" action="<%=request.servervariables("script_name")%>">
    <p>
    .......
    <input type="submit" value="add" name="add">
    <input type="submit" value="delete" name="delete">
    </form>
    <% else %>
    <form method="post" action="<%=request.servervariables("script_name")%>"
    <% if isadd then %>
    <p>You are about to add the following...
    <input type="submit" value="Confirm Addition" name="confirm">
    </p>
    <% end if%>
    <% if isdelete then %>
    <p>You are about to delete the following...
    <input type="submit" value="Confirm Deletion" name="confirm">
    </p>
    <% end if %>
    </form>
    <%end if%>


    --
    Adrienne Boswell
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne, Aug 17, 2005
    #4
  5. Jukka K. Korpela, Aug 17, 2005
    #5
  6. roN

    roN Guest

    Jukka K. Korpela wrote:
    > "roN" <> wrote:
    >
    >> So how would you solve this problem?

    >
    > I wouldn't create it in the first place. Did I say this too
    > implicitly? Simply use one submit button. Use other controls to let
    > the user select an action.


    But If it would work I think it would have been the best version if you have
    one select-box with several entries to add some new or the delete or either
    to edit them...... annother good idea?

    --
    chEErs roN
    kEEp on rockin'
     
    roN, Aug 17, 2005
    #6
    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. Roger
    Replies:
    1
    Views:
    655
    GreggTB
    May 20, 2005
  2. Replies:
    4
    Views:
    980
  3. Michael
    Replies:
    4
    Views:
    452
    Matt Hammond
    Jun 26, 2006
  4. Sivaswami Jeganathan

    how to handle more than one submit buttons

    Sivaswami Jeganathan, Mar 24, 2006, in forum: ASP General
    Replies:
    1
    Views:
    131
    Bob Barrows [MVP]
    Mar 24, 2006
  5. Robert Klemme

    With a Ruby Yell: more, more more!

    Robert Klemme, Sep 28, 2005, in forum: Ruby
    Replies:
    5
    Views:
    229
    Jeff Wood
    Sep 29, 2005
Loading...

Share This Page