SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict next2heaven's Avatar
    Join Date
    Apr 2005
    Posts
    257
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Submit form with image button returns nothing if using <space> or <enter>

    My form isn't returning any results when submitting the form if the user hits the <spacebar> or the <enter> key on the keyboard when tabbed over the image submit button.

    Code:
    <input name="Submit_notes" type="image" value="Submit_notes" src="images/pp_but_blu_addentry.gif" />
    Should I make it so the user can't submit with the keyboard? (if so how) or is there another way?

  2. #2
    SitePoint Evangelist
    Join Date
    Apr 2006
    Location
    Halifax, Canada
    Posts
    498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would have to see the rest of the HTML to figure out why the rest of the info would not send, but preventing users from submitting with the keyboard is easy:

    Code:
    <input name="Submit_notes" type="image" onkeypress="return false" value="Submit_notes" src="images/pp_but_blu_addentry.gif" />
    Paul Butler.org
    JSSpamBlock - Reduce WordPress spam.

  3. #3
    SitePoint Addict next2heaven's Avatar
    Join Date
    Apr 2005
    Posts
    257
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Here is the code...

    here's the code but the onKeyPress didn't work.

    Code:
    <form action="player_detail.php?tab=notes<?=$extra_vars;?>" method="post" enctype="multipart/form-data" name="form_notes5" class="no_margins">
    <div><textarea name="content" class="t_11" style="width:253px; height:100px;"></textarea></div>
    <div><img src="images/spacer.gif" height="9"><input name="personal" type="hidden" value="1" /></div>
    <div align="right"><input name="Submit_notes" type="image" value="Submit_notes" src="images/pp_but_blu_addentry.gif" onkeypress="return false" /></div>
    </form>

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    What happens if they don't have any way except the keyboard to subbmit the form. Not everyone has a mouse.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    SitePoint Addict next2heaven's Avatar
    Join Date
    Apr 2005
    Posts
    257
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What do I do? What's the problem with it?

  6. #6
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    what does the PHP look like?
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



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
  •