Submit Your Article
Home Articles News Tutorials Videos Add An Article
Topics: Design Photoshop Programming PHP CSS Java Database Web Development Javascript Ajax
– Close + Open

Find Out More About DevWebPro!

Sign up for the newsletter


» Terms & Conditions

Welcome to the New DevWebPro!

DevWebPro Includes:
  Hundreds Of Tutorials   Developer News
  Unique Gadget Videos   Tons of Topics to Discuss
  Expert Advice   We Will Publish Your Articles

Form Submit Image Doesn’t Submit on Enter

Saturday, January 27th, 2007
Text: Decrease Font Size Increase Font Size | Print Print Article | Share: Delicious Digg StumbleUpon Post to Twitter Post to Facebook

Recently I was working on a simple ‘Go to page #’ form for a book list with multiple pages. Usually, this works without a hitch but something on this page was stopping the ‘Enter’ key functionality to submit the form. When a user types in a page # into the input field and clicks the go button (input type="image", in this case), the form submits fine. I discovered the root of this problem was actually the input button and our use of input type="image" instead of input type="submit". The submit button code was using input type=”image” instead of input type=”submit” but the goal was to have it function in the same way.

However, when a user inputs a page # into the input field and presses the ‘Enter’ (or return) key, the page just refreshes.

The button code looks like this:

<input src="/images/btn_go.gif" alt="GO" class="go_btn" name="navigateGo" type="image" />

The fix was simple:
Use an actual submit button and style it with a background image using CSS.

<input class="go_btn" name="navigateGo" type="submit" />

W3 specifies VALUE is not required for submit buttons.

Has anyone run into this problem and discovered an alternative solution?

Topics: , ,

Leave a Comment

DevWebPro is an iEntry Network ® publication - © 1998-2010 All Rights Reserved