On 14/01/2010 12:24 AM, Freddy Daoud wrote:
I recall JavaScript form submits having problems if an element is
named "submit".
By the way, more info on that issue here, if you are interested:
http://stackoverflow.com/questions/876243/
why-does-naming-your-html-form-submit-button-submit-break-things
Thanks Freddy. I've come up with a small JS function for form submissions that will popup an alert
about this problem:
submitForm=function(form, validate) {
if (form) {
if(document.getElementsByName('submit').length != 0) {
alert('Error: In order to submit the Form through JavaScript, buttons and fields must not be
named "submit". Please rename the button/field called "submit".');
return false;
}
form.submit();
}
}
Then instead of:
submit.setAttribute("onclick", "form.submit()");
do:
submit.setAttribute("onclick", "submitForm(form)");
kind regards
bob