Forum Moderators: open
fintan
function cancel_submit(e, form_sub){ // Cancels the enter behaviour for submiting forms unless submit is pressed
var formObj = document.forms[0]; //forms[0];
if(EnterPressed(e)) {
for(var i = 0; i < formObj.length; i++){
if(formObj.elements[i].type == 'submit' && formObj.elements[i].focus()) {
alert(formObj.elements[i]);
}
}
return false;
}
else{
return false;
}
}
On the other hand, if you don't add a "submit" button to your form, then you only need to make one normal button, which will have document.form.submit() in its onclick event. In this case the user can not initiate the submitting anymore, but you can still do that from the code.