unemployment Posted February 5, 2011 Share Posted February 5, 2011 I can't get the form to submit even after the validation is approved. Any guesses as to why? <form class="contact" method="post" action="contact.php" name="contact" onsubmit="return messagesend()"> messagesend.onclick = function(){ if (fullnameform == null || fullnameform =="" || emailform == null || emailform =="" || subjectform == null || subjectform =="" || bodyform == null || bodyform =="") { if (fullname.value.length === 0){ show_error(fullname_msg, 'This field is required.'); messagesend.disabled = true; }else if (fullname.value.match(/^[a-zA-Z]+$/) === null){ show_error(fullname_msg, 'Invalid name (letters only).'); }else{ removeChildren(fullname_msg); } if (email.value.length === 0){ show_error(email_msg, 'This field is required.'); }else if (email.value.match(/^[a-z0-9\-\.\_\+]{1,64}\@(?:[a-z0-9\-\_]+)\.(?:[a-z]{2,4}|[a-z]{2,3}\.[a-z]{2,3})$/) === null){ show_error(email_msg, 'Invalid e-mail address.'); }else{ removeChildren(email_msg); } if (subject.value.length === 0){ show_error(subject_msg, 'This field is required.'); }else if (subject.value.match(/^[a-zA-Z]+$/) === null){ show_error(subject_msg, 'Invalid name (letters only).'); }else{ removeChildren(subject_msg); } if (body.value.length === 0){ show_error(body_msg, 'This field is required.'); }else if (body.value.match(/^[a-zA-Z]+$/) === null){ show_error(body_msg, 'Invalid name (letters only).'); }else{ removeChildren(body_msg); } return false; } } Link to comment https://forums.phpfreaks.com/topic/226817-form-wont-submit/ Share on other sites More sharing options...
sunfighter Posted February 5, 2011 Share Posted February 5, 2011 I submit my forms in the function with document.forms["myform"].submit(); Link to comment https://forums.phpfreaks.com/topic/226817-form-wont-submit/#findComment-1170428 Share on other sites More sharing options...
lordsavage Posted February 11, 2011 Share Posted February 11, 2011 The onsubmit method of the form requires a true|false statement to be able to submit or not. based on your code above i cannot see how that function "messagesend.onclick" is called from the onsubmit of the form but assuming it does then change the final statement of that function to return true; instead of return false; and that should work. Link to comment https://forums.phpfreaks.com/topic/226817-form-wont-submit/#findComment-1172607 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.