• GoDaddy Community
  • Websites + Marketing | Website Builders
  • Websites + Marketing | Website Builders

    cancel
    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 
    Go to solution

    HTML submit button not working

    Can anyone help me with my HTML code?  The submit button doesn't work. 

    1 ACCEPTED SOLUTION

    The regular fixes are not working because of how the form is submitted.  Have you tried the built in form?  A Contact Us section can be added, then just delete the text you don't need and edit the form fields as needed.

    View solution in original post

    3 REPLIES 3
    Super User II

    For a form to work a target needs to be set, use "_top" for same window or "_blank" to open new window.

     

     

    <form target="_top" action...

     

    This is what I have - can you help with this @Nate ?

     

    <form method="post" action="//submit.form" onSubmit="return validateForm();">
    <div style="width: 400px;">
    </div>
    <div style="padding-bottom: 18px;font-size : 24px;">Contest Entry</div>
    <div style="padding-bottom: 18px;font-size : 18px;">Enter our monthly contest</div>
    <div style="display: flex; padding-bottom: 18px;width : 550px;">
    <div style=" margin-left : 0; margin-right : 1%; width : 49%;">First name<span style="color: red;"> *</span><br/>
    <input type="text" id="data_3" name="data_3" style="width: 100%;" class="form-control"/>
    </div>
    <div style=" margin-left : 1%; margin-right : 0; width : 49%;">Last name<span style="color: red;"> *</span><br/>
    <input type="text" id="data_4" name="data_4" style="width: 100%;" class="form-control"/>
    </div>
    </div><div style="padding-bottom: 18px;">Email<br/>
    <input type="text" id="data_5" name="data_5" style="width : 550px;" class="form-control
    <input type="text" id="data_7" name="data_7" style="width : 250px;" class="form-control"/>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.4.0/pikaday.min.js" type="text/javascript"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.4.0/css/pikaday.min.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">new Pikaday({ field: document.getElementById('data_7') });</script>
    <div style="padding-bottom: 18px;">
    <div style="padding-bottom: 18px;"><input name="skip_Submit" value="Submit" type="submit"/></div>
    <div>
    <div style="float:right"><a href="https://www.100forms.com" id="lnk100" title="form to type="text/javascript"></script>
    </div>
    </form>

    <script type="text/javascript">
    function validateForm() {
    if (isEmpty(document.getElementById('data_3').value.trim())) {
    alert('First name is required!');
    return false;
    }
    if (isEmpty(document.getElementById('data_4').value.trim())) {
    alert('Last name is required!');
    return false;
    }
    if (!validateEmail(document.getElementById('data_5').value.trim())) {
    alert('Email must be a valid email address!');
    return false;
    }
    if (!document.getElementById('data_6_0').checked && !document.getElementById('data_6_1').checked ) {
    alert('Previous participant? is required!');
    return false;}
    if (!document.getElementById('data_8_0').checked && !document.getElementById('data_8_1').checked ) {
    alert('Gender is required!');
    return false;}
    return true;
    }
    function isEmpty(str) { return (str.length === 0 || !str.trim()); }
    function validateEmail(email) {
    var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,15}(?:\.[a-z]{2})?)$/i;
    return isEmpty(email) || re.test(email);
    }
    </script>

    The regular fixes are not working because of how the form is submitted.  Have you tried the built in form?  A Contact Us section can be added, then just delete the text you don't need and edit the form fields as needed.

    View solution in original post