DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    val Guest

    multiple buttons on a form


    This seems like a silly question, but I am wondering if anyone knows how to
    default which button will be clicked when a user hits return on a form with
    multiple buttons. The first button on the form is the one whose event is
    automatically fired. I don't want that to happen.

    In the .net framework library, I found information about creating the asp:buttons
    as either a command or a submit button. I then created the first button
    as a command, and the second as a submit, hoping to fire the second button
    when the user of my form presses return. No such luck. I also tried setting
    the "CausesValidation" of the first button to false, but still the first
    button is the one clicked by default when the user presses return.

    Any ideas?

  2. #2
    Lonzo Guest

    Re: multiple buttons on a form


    It's kinda browser specific, however there are ways to handle for different
    browser types; see the link below:

    http://ppewww.ph.gla.ac.uk/%7eflavel...mquestion.html



    "val" <vwinberg@hotmail.com> wrote:
    >
    >This seems like a silly question, but I am wondering if anyone knows how

    to
    >default which button will be clicked when a user hits return on a form with
    >multiple buttons. The first button on the form is the one whose event is
    >automatically fired. I don't want that to happen.
    >
    >In the .net framework library, I found information about creating the asp:buttons
    >as either a command or a submit button. I then created the first button
    >as a command, and the second as a submit, hoping to fire the second button
    >when the user of my form presses return. No such luck. I also tried setting
    >the "CausesValidation" of the first button to false, but still the first
    >button is the one clicked by default when the user presses return.
    >
    >Any ideas?



  3. #3
    arkatala Guest

    Re: multiple buttons on a form


    Do anyone have the answer for the following question.


    "Lonzo" <lonny.angell@omniresources.com> wrote:
    >
    >It's kinda browser specific, however there are ways to handle for different
    >browser types; see the link below:
    >
    > http://ppewww.ph.gla.ac.uk/%7eflavel...mquestion.html
    >
    >
    >
    >"val" <vwinberg@hotmail.com> wrote:
    >>
    >>This seems like a silly question, but I am wondering if anyone knows how

    >to
    >>default which button will be clicked when a user hits return on a form

    with
    >>multiple buttons. The first button on the form is the one whose event

    is
    >>automatically fired. I don't want that to happen.
    >>
    >>In the .net framework library, I found information about creating the asp:buttons
    >>as either a command or a submit button. I then created the first button
    >>as a command, and the second as a submit, hoping to fire the second button
    >>when the user of my form presses return. No such luck. I also tried setting
    >>the "CausesValidation" of the first button to false, but still the first
    >>button is the one clicked by default when the user presses return.
    >>
    >>Any ideas?

    >



  4. #4
    David Sumner Guest

    Re: multiple buttons on a form


    Hello,
    Haven't tried this myself to see if it works, but try setting the TabIndex
    value of the button you want to be the default to 0 and any other buttons
    to 1 or higher. Its what I would try, but again not definitely sure it will
    work.




    "arkatala" <arkatala@hotmail.com> wrote:
    >
    >Do anyone have the answer for the following question.
    >
    >
    >"Lonzo" <lonny.angell@omniresources.com> wrote:
    >>
    >>It's kinda browser specific, however there are ways to handle for different
    >>browser types; see the link below:
    >>
    >> http://ppewww.ph.gla.ac.uk/%7eflavel...mquestion.html
    >>
    >>
    >>
    >>"val" <vwinberg@hotmail.com> wrote:
    >>>
    >>>This seems like a silly question, but I am wondering if anyone knows how

    >>to
    >>>default which button will be clicked when a user hits return on a form

    >with
    >>>multiple buttons. The first button on the form is the one whose event

    >is
    >>>automatically fired. I don't want that to happen.
    >>>
    >>>In the .net framework library, I found information about creating the

    asp:buttons
    >>>as either a command or a submit button. I then created the first button
    >>>as a command, and the second as a submit, hoping to fire the second button
    >>>when the user of my form presses return. No such luck. I also tried

    setting
    >>>the "CausesValidation" of the first button to false, but still the first
    >>>button is the one clicked by default when the user presses return.
    >>>
    >>>Any ideas?

    >>

    >



  5. #5
    me Guest

    Re: multiple buttons on a form


    Hi,
    This is basic stuff. Try using type=button for all buttons except the one
    you want to submit automatically. Then use the onclick event and javascript
    to handle those buttons.


    =================
    "arkatala" <arkatala@hotmail.com> wrote:
    >
    >Do anyone have the answer for the following question.
    >
    >
    >"Lonzo" <lonny.angell@omniresources.com> wrote:
    >>
    >>It's kinda browser specific, however there are ways to handle for different
    >>browser types; see the link below:
    >>
    >> http://ppewww.ph.gla.ac.uk/%7eflavel...mquestion.html
    >>
    >>
    >>
    >>"val" <vwinberg@hotmail.com> wrote:
    >>>
    >>>This seems like a silly question, but I am wondering if anyone knows how

    >>to
    >>>default which button will be clicked when a user hits return on a form

    >with
    >>>multiple buttons. The first button on the form is the one whose event

    >is
    >>>automatically fired. I don't want that to happen.
    >>>
    >>>In the .net framework library, I found information about creating the

    asp:buttons
    >>>as either a command or a submit button. I then created the first button
    >>>as a command, and the second as a submit, hoping to fire the second button
    >>>when the user of my form presses return. No such luck. I also tried

    setting
    >>>the "CausesValidation" of the first button to false, but still the first
    >>>button is the one clicked by default when the user presses return.
    >>>
    >>>Any ideas?

    >>

    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links