Submit Form problem... Enter key

ajax, forms, html, mysql, php

Solution

change your onsubmit to onsubmit="return AjaxFunction();" and return false from your AjaxFunction. That will prevent the form from submiting.

Problem

I have a form containing several drop lists and a text field, and a button... When I click the button, an ajaxfunction is called... the ajax then calls a php function which gets results from a mysql db... The problem is that I cant do the same thing by just hitting enter in the form, the page just gets refreshed... That explained, I think the form gets submitted, but ignores the ajaxfunction when hitting enter, EVEN though i have " onSubmit="AjaxFunction();" in the form tag... Any ideas? Does anybody know a way to ignore the form submit when hitting enter? and maybe instead click the button when hitting enter? Thanks...

Original source

Related problems