Jump to content

Form won't submit


unemployment

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.