Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder howie2009's Avatar
    Join Date
    May 2009
    Location
    Ireland
    Posts
    204
    Thanks
    37
    Thanked 0 Times in 0 Posts

    form post action do nothing

    Hi Guys,
    How do I get

    Code:
    <form method="post" action="">
    to have no action whatsoever when Enter button is pressed in the following textbox:

    Code:
    <input type="text" name="keywords"/>
    I just have a particular use for it and at the moment when I hit Enter in the textbox it refreshes the page. I want Enter to do zilch, nada.

    THANKS!

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,021
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Code:
    <form ... onsubmit="return false;">
    A blank action is 100% the same as using action="theCurrentPage.xxx". That is, it indeed simply tells the <form> to post back to the same page.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Regular Coder howie2009's Avatar
    Join Date
    May 2009
    Location
    Ireland
    Posts
    204
    Thanks
    37
    Thanked 0 Times in 0 Posts
    Perfect! THANKS!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •