Forum Moderators: coopster
As far as I know form submissing is no different if it is done from clicking the submit button, pressing enter or using javascript.
The only thing I can think of is, sometimes people use the value of the submit button as a check to see which button was pressed (if there are multiple submit buttons), so by pressing enter it may submit the form but not set the value. For example:
<input type="submit" name="myform" value="Submit" />
You might have PHP code like:
<?php
if ($_POST["myform"] == "Submit") {
//process myform here
}
?>
However I believe if you press enter its the same as pressing the enter button anyway. Its a weird one, perhaps more details will help us solve your problem?
<FORM ... onSubmit="return validate(this);">
where 'validate()' is a JS function that returns a boolean value. This method will work if the submit button is pressed OR the user hits Enter.
The way NOT to do it is:
<INPUT type="button" ... onClick="validate(this.form);">
Where 'validate()' is a JS function that calls 'form.submit()'. If you don't click the button then the form won't be validated/submitted.
;)