Re: Altering default submit button when user presses Enter

Discussion in 'HTML' started by BootNic, Aug 4, 2008.

  1. BootNic

    BootNic Guest

    On Mon, 04 Aug 2008 00:01:58 +0100
    (Philip Ronan) wrote in:
    <phil.ronan-0408080001580001@10.0.1.2>

    > Hi,
    >
    > I'm making a contact form for my website. It looks a bit like this:

    [snip]

    A URL would be preferred over text art.

    > Basically it has 3 submit buttons -- one for deleting attachments, another
    > for adding attachments, and a third for submitting the whole message.

    [snip]

    As it turns out submit buttons are best used to submit a form. Perhaps
    the best way to fix this issue is to not create the issue. Consider
    using checkboxes for deleting/adding attachments.

    [snip]


    --

    BootNic Sun Aug 3, 2008 11:17 pm
    When I was young, I was put in a school for retarded kids for two
    years before they realized I actually had a hearing loss...and they
    called ME slow!
    *Kathy Buckley*

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.9 (GNU/Linux)

    iEYEARECAAYFAkiWdNwACgkQylMUzZO6jeJzTACgi1IcVvfB+6cDoR2b8a0Vfocn
    lW8An0gcVj7vitgNso1rvNF16dyijloU
    =EZCP
    -----END PGP SIGNATURE-----
     
    BootNic, Aug 4, 2008
    #1
    1. Advertising

  2. BootNic

    BootNic Guest

    On Mon, 04 Aug 2008 10:21:43 +0100
    (Philip Ronan) wrote in:
    <phil.ronan-0408081021430001@10.0.1.2>

    > In article <>, BootNic
    > <> wrote:
    >
    > > As it turns out submit buttons are best used to submit a form. Perhaps
    > > the best way to fix this issue is to not create the issue. Consider
    > > using checkboxes for deleting/adding attachments.

    >
    > I don't follow you, sorry.
    >
    > Are you suggesting it's better to use a checkbox to initiate a server
    > action (like responding with a file upload form or deleting a previously
    > uploaded file)? Isn't that what submit buttons are for?


    I suggested that you replace the extra submit buttons with checkboxes,
    then when the form is submitted, check the checkboxes and process it as
    needed.

    > Besides, that would only work with Javascript enabled, and like I said, I
    > can use Javascript to prevent the Enter key from submitting the form.


    Javascript is not required to process a form. The issue is that you
    have multiple submit buttons when you only need one.

    > I'm afraid I can't provide a URL because the page is only running on my
    > desktop box at the moment. I just thought someone here might have run into
    > this problem before.


    I realize that free host are difficult to find.

    Here is one such host, I have to caution you because it offers 250MB
    Disk Space, 6GB Traffic, 2 Domains Hosting, PHP, Perl, MySQL, FTP,
    Instant Activation!

    The worst thing is that they do not place adds on your site or muck
    about with your files.

    http://www.leadhoster.com/signup.html

    Now if you choose to setup a free host, then upload your minimal valid
    example, you just may get more input and suggestion.

    --

    BootNic Mon Aug 4, 2008 11:32 am
    Optimism and humor are the grease and glue of life. Without both of
    them we would never have survived our captivity.
    *Philip Butler, Vietnam POW*

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.9 (GNU/Linux)

    iEYEARECAAYFAkiXITcACgkQylMUzZO6jeIXrQCdEzxly1MbDWfvoRpshj5FftpS
    59MAniBLmMF3DcuBzXsbFkCu7pp46DyD
    =I0T3
    -----END PGP SIGNATURE-----
     
    BootNic, Aug 4, 2008
    #2
    1. Advertising

  3. Scripsit Philip Ronan:

    > In article <>, BootNic
    > <> wrote:
    >
    >> The issue is that you
    >> have multiple submit buttons when you only need one.

    >
    > Well I'm not going to register a web domain just so I can demonstrate
    > things to you.


    You don't have to do anything to please "BootNic", an anonymous entity
    who posts something binary (well, non-plain-text) to Usenet.

    But if you want to get constructive help with web authoring problems,
    upload a demo document onto a web server. Everyone and her dog can do
    _that_, without registering a domain or buying a castle.

    However, if my computer isn't asleep then you might be
    > able to access something here:
    >
    > http://77.103.71.10/contact.php
    >
    > You really need to justify this claim that the form only needs one
    > submit button. I think you're wrong.


    Quite possibly, but it's the opposite that needs a proof. Anyway,
    "multiple submit buttons" should give enough Google hits to help you
    spend a few days reading about the issue...

    > In fact the only way to make this work with one submit button would
    > be to insert multiple file upload elements into the contact form
    > itself.


    Huh? What _are_ you doing? What's text-file.doc supposed to be? Is the
    form supposed to do _anything_? (It doesn't seem to.)

    As a rule, if you want to have operations for, say, adding files
    somewhere or deleting files from somewhere, create one form for one
    basic type of operation (adding files, deleting files).

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Aug 4, 2008
    #3
  4. BootNic

    BootNic Guest

    OT: Altering default submit button when user presses Enter

    On Mon, 4 Aug 2008 23:27:19 +0300
    "Jukka K. Korpela" <> wrote in:
    <QCJlk.44749$>

    [snip]
    > You don't have to do anything to please "BootNic", an anonymous entity
    > who posts something binary (well, non-plain-text) to Usenet.


    Anonymous?

    Just how do you determine what is anonymous?

    [snip]


    --

    BootNic Mon Aug 4, 2008 05:55 pm
    Get your facts first, and then you can distort them as much as you
    please.
    *Mark Twain*

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.9 (GNU/Linux)

    iEYEARECAAYFAkiXetUACgkQylMUzZO6jeJQwACeKwcbwsJ0LiCia0S5pKM/3W2U
    YjoAoKuB0Z8MHSZ7oMlxldG4wBessLi9
    =HZAG
    -----END PGP SIGNATURE-----
     
    BootNic, Aug 4, 2008
    #4
  5. BootNic

    BootNic Guest

    On Mon, 04 Aug 2008 18:58:25 +0100
    (Philip Ronan) wrote in:
    <phil.ronan-0408081858250001@10.0.1.2>

    > In article <>, BootNic
    > <> wrote:
    >
    > > The issue is that you
    > > have multiple submit buttons when you only need one.

    >
    > Well I'm not going to register a web domain just so I can demonstrate
    > things to you. However, if my computer isn't asleep then you might be able
    > to access something here:


    The URL I provided did not require you to register a domain. There is
    an option to get a free sub domain, if you were to take time to read the
    information.

    > http://77.103.71.10/contact.php
    >
    > You really need to justify this claim that the form only needs one submit
    > button. I think you're wrong.


    Just how would you suggest I justify this to your satisfaction?

    > In fact the only way to make this work with one submit button would be to
    > insert multiple file upload elements into the contact form itself. Without
    > Javascript, that would look messy (since there is no way of adjusting the
    > number of form elements client-side without JS). If would also be a damn
    > nuisance if a user uploaded a bunch of files only to have the server
    > respond with an error about the email address not validating, for example.


    If you just want to do this client-side, java script would be the way to
    go I suppose. To do that you could use a button or input with the type
    of button, then assign an onclick event for them.

    How the server responds to an error concerning form data validating
    would be a sever side script issue. The server could return the form
    as it was with a notice of some sort.

    > So in terms of usability, this approach is much better. It's just the way
    > browsers handle the Enter key that's causing the problem.


    I always thought that in terms of usability it's best not to muck about
    with the defaults.

    A form example:

    http://tinyurl.com/637o7j

    --

    BootNic Mon Aug 4, 2008 06:19 pm
    Imagination was given to man to compensate him for what he isn't. A
    sense of humor was provided to console him for what he is.
    *Horace Walpole English novelist*

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.9 (GNU/Linux)

    iEYEARECAAYFAkiXgH0ACgkQylMUzZO6jeJm+gCgqvZRDv2V4uN4GM6Mt8KVtoZJ
    +CkAnRpAThjTiQN/T4Jw+MrUDaF0nET4
    =wYdd
    -----END PGP SIGNATURE-----
     
    BootNic, Aug 4, 2008
    #5
  6. BootNic

    Ari Heino Guest

    OT: Altering default submit button when user presses Enter

    > The URL I provided did not require you to register a domain. There is
    > an option to get a free sub domain, if you were to take time to read the
    > information.


    IMHO that page was somewhat complex. I have free pages under Googlepages
    and have found it million time easier to use.

    --
    Ari
     
    Ari Heino, Aug 4, 2008
    #6
  7. Scripsit Philip Ronan:

    > It's supposed to demonstrate the fact that
    > pressing the return key in a text input field causes the browser to
    > simulate a click on the first button in the form.


    That used to be one of the Frequently Asked Questions, in the good old
    days when FAQs flourished and everything was so much better. You might
    still find it in some FAQ resource. But the bottom line is that you just
    have to live with it - and design pages so that they work despite it.

    > OK, so let's suppose I'm using two separate forms. One to manage the
    > attached files (let's call it "form 1"), and another where the user
    > provides a name, email address and a message ("form 2").


    Which "attached files"? Something already uploaded on a server? Or
    something _to be_ uploaded, in which case it's a matter of file field(s)
    in the form.

    > The user fills out form 2, and then clicks a button in form 1 to
    > attach a file (or delete one that was uploaded earlier).


    Wait a second. Attaching a file and deleting a file are quite different
    operations - in the technical sense, too.

    > Since the
    > user is now submitting a separate form, everything the user just
    > typed into form 2 will be lost.


    Of course. You should normally have one form _per page_, with one page
    for one kind of action, though in simple cases you might put two or even
    more forms on one page, but each of them should work independently of
    the others.

    > I think what I'm going to do is add a dummy submit button wrapped in a
    > noscript element at the beginning of the form, but if you can suggest
    > a better alternative then please do.


    If that's a solution, the problem must be odd. I still don't think the
    problem has been described in a manner that makes it possible to suggest
    specific solutions.

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Aug 5, 2008
    #7
  8. Gazing into my crystal ball I observed
    (Philip Ronan) writing in news:phil.ronan-0508082246100001@10.0.1.2:

    >> Of course. You should normally have one form _per page_, with one
    >> page for one kind of action, though in simple cases you might put two
    >> or even more forms on one page, but each of them should work
    >> independently of the others.

    >
    > Hmm. BootNic seems to think so too. We'll just have to disagree on
    > that.
    >
    >


    One of the first things toddlers learn how to do is to sort. Green
    blocks go in the green box, red in the red box, blue in the blue box,
    etc. This is a good thing, because as adults, we sort on a regular
    basis.

    If you have a form that serves many functions, it is hard to sort out.
    Do I want to delete? Do I want to add? Do I just want to edit? How do
    I do that? Oh, ok, here's a link to delete, and one to add and one to
    edit. And each has a simple form that does just the one thing it is
    supposed to do. "That was Easy".

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, Aug 6, 2008
    #8
  9. BootNic

    Neredbojias Guest

    On 06 Aug 2008, (Philip Ronan) wrote:

    > In article <Xns9AF1BAE165A3Darbpenyahoocom@69.16.185.250>, Adrienne
    > Boswell <> wrote:
    >
    >> One of the first things toddlers learn how to do is to sort. Green
    >> blocks go in the green box, red in the red box, blue in the blue box,
    >> etc. This is a good thing, because as adults, we sort on a regular
    >> basis.
    >>
    >> If you have a form that serves many functions, it is hard to sort out.
    >> Do I want to delete? Do I want to add? Do I just want to edit? How
    >> do I do that? Oh, ok, here's a link to delete, and one to add and one
    >> to edit. And each has a simple form that does just the one thing it is
    >> supposed to do. "That was Easy".

    >
    > Hmmm.
    >
    > Do you have a helper who comes round occasionally to do chores for you?
    > Like operating the washing machine and changing channels on the TV?
    >
    > I mean, if a form with three buttons is enough to get you confused, then
    > the world must be a big scary place, huh?
    >
    > I can see it's time for me to get the hell out of here.
    >
    > Keep taking the meds.


    Either she's been talking to dorayme too much or it's one of those
    two-buck-chuck days.

    --
    Neredbojias
    http://www.neredbojias.net/
    Public Website
     
    Neredbojias, Aug 6, 2008
    #9
  10. BootNic

    dorayme Guest

    In article <phil.ronan-0608080955560001@10.0.1.2>,
    (Philip Ronan) wrote:

    > In article <Xns9AF1BAE165A3Darbpenyahoocom@69.16.185.250>, Adrienne
    > Boswell <> wrote:
    >
    > > One of the first things toddlers learn how to do is to sort. Green
    > > blocks go in the green box, red in the red box, blue in the blue box,
    > > etc. This is a good thing, because as adults, we sort on a regular
    > > basis.
    > >
    > > If you have a form that serves many functions, it is hard to sort out.
    > > Do I want to delete? Do I want to add? Do I just want to edit? How do
    > > I do that? Oh, ok, here's a link to delete, and one to add and one to
    > > edit. And each has a simple form that does just the one thing it is
    > > supposed to do. "That was Easy".

    >
    > Hmmm.
    >
    > Do you have a helper who comes round occasionally to do chores for you?
    > Like operating the washing machine and changing channels on the TV?
    >
    > I mean, if a form with three buttons is enough to get you confused, then
    > the world must be a big scary place, huh?
    >
    > I can see it's time for me to get the hell out of here.
    >
    > Keep taking the meds.


    Here was Adrienne suggesting that simplicity is a good thing and easy to
    do and easy to appreciate and why complicate things and there is this
    reaction?

    --
    dorayme
     
    dorayme, Aug 6, 2008
    #10
  11. Gazing into my crystal ball I observed
    (Philip Ronan) writing in news:phil.ronan-0608080955560001@10.0.1.2:

    > In article <Xns9AF1BAE165A3Darbpenyahoocom@69.16.185.250>, Adrienne
    > Boswell <> wrote:
    >
    >> One of the first things toddlers learn how to do is to sort. Green
    >> blocks go in the green box, red in the red box, blue in the blue box,
    >> etc. This is a good thing, because as adults, we sort on a regular
    >> basis.
    >>
    >> If you have a form that serves many functions, it is hard to sort
    >> out. Do I want to delete? Do I want to add? Do I just want to
    >> edit? How do I do that? Oh, ok, here's a link to delete, and one to
    >> add and one to edit. And each has a simple form that does just the
    >> one thing it is supposed to do. "That was Easy".

    >
    > Hmmm.
    >
    > Do you have a helper who comes round occasionally to do chores for
    > you? Like operating the washing machine and changing channels on the
    > TV?
    >


    I have a preschooler who enjoys sorting laundry, and a remote to control
    the television.

    > I mean, if a form with three buttons is enough to get you confused,
    > then the world must be a big scary place, huh?


    I have seen intelligent people get confused when offered several
    buttons. Registering a domain at GoDaddy comes to mind, and I think
    this might be on purpose. If the user gets confused, they might
    purchase things they do not really need.

    >
    > I can see it's time for me to get the hell out of here.


    Please do.

    >
    > Keep taking the meds.
    >


    Nah, a little two buck Chuck tonight might be just the ticket.


    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, Aug 6, 2008
    #11
  12. Scripsit Philip Ronan:

    > Files are uploaded on a separate page which is accessed by clicking
    > the "Attach file" button. This "attaches" them to the message by
    > adding the local filename of the uploaded file to the session
    > variables.


    Local filename? You aren't very specific. Local to user's system or to
    server? Do you think you can reliably retrieve the local filename on
    user's system? For all that you can know, an uploaded file need not even
    have a name.

    >> Wait a second. Attaching a file and deleting a file are quite
    >> different operations - in the technical sense, too.

    >
    > Correct. That's why I provided different buttons for these actions.


    Sigh. They also need different other controls, so why put them into the
    same form or even the same page?

    > Well it *is* an odd problem. There's no reason why browsers should
    > default to behaving in this stupid manner.


    There is, and in the good old times people checked this out from the
    FAQs. The original idea was great, then Microsoft spoiled it, and here
    we are.

    > But don't worry. The
    > hidden submit button works just fine:
    >
    > http://77.103.71.10/contact.php


    For some values of "work" and "fine", maybe. But since you still don't
    verbally describe what you are doing, I won't bother accessing a
    presumably non-real demo page on a server with a numeric address.

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Aug 6, 2008
    #12
    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. =?Utf-8?B?amwzOTc3NQ==?=

    Fire btnSubmit when user presses Enter on keyboard

    =?Utf-8?B?amwzOTc3NQ==?=, Sep 23, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    2,674
    Brian Burgess
    Nov 20, 2004
  2. Moose
    Replies:
    6
    Views:
    15,356
    Alfonso Esteban Perdigón
    Aug 17, 2004
  3. BrianDH

    Enter Key H*ll, control enter key submit button

    BrianDH, Jan 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    404
    Anders Matthiessen
    Jan 12, 2005
  4. Guest
    Replies:
    2
    Views:
    1,604
    Guest
    Oct 25, 2004
  5. jiayanxiang
    Replies:
    2
    Views:
    111
    Erwin Moller
    May 30, 2008
Loading...

Share This Page