Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8355745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:57:37+00:00 2026-06-09T09:57:37+00:00

Would anyone know why my submit button wouldn’t call javascript to verify if certain

  • 0

Would anyone know why my submit button wouldn’t call javascript to verify if certain fields are populated in the form?

To have better idea I have provided a link to the website: http://www.flyingcowproduction.com/pls and click on the button “reservation” from the top menu.

Form:

<form method="post" action="process.php">
                <div class="grid_6">
                    <div class="element">
                        <label>Name*</label>
                        <input type="text" name="name" class="text" style="width:427px;" />
                    </div>
                </div>
                <div class="clear"></div>
                <div class="grid_3">
                    <div class="element">
                        <label>Email*</label>
                        <input type="text" name="email" class="text" style="width:200px;" />
                    </div>
                </div>
                <div class="grid_3">
                    <div class="element">
                        <label>Phone</label>
                        <input type="text" name="phone" class="text" style="width:200px;" />
                    </div>
                </div>
                <div class="clear"></div>
                <div class="grid_3">
                    <div class="element">
                        <label>Address*</label>
                        <input type="text" name="address" class="text" style="width:200px;" />
                    </div>
                </div>
                <div class="grid_2">
                    <div class="element">
                        <label>City*</label>
                        <input type="text" name="city" class="text" style="width:119px;" />
                    </div>
                </div>
                <div class="grid_1">
                    <div class="element">
                        <label>Zip*</label>
                        <input type="text" name="zipcode" class="text" style="width:55px;" />
                    </div>
                </div>
                <div class="clear"></div>
                <div class="grid_6">
                    <div class="element">
                        <label>Where do you want to go?*</label>
                        <input type="text" name="service" class="text" style="width:427px;" />
                    </div>
                </div>
                <div class="clear"></div>
                <div class="grid_3">
                    <div class="element">
                        <label>Date and time of service*</label>
                        <input type="text" name="datetime" class="text" style="width:200px;" />
                    </div>
                </div>
                <div class="grid_2">
                    <div class="element">
                        <label>Passengers (max)</label>
                        <input type="text" name="passingers" class="text" style="width:75px;" />
                    </div>
                </div>
                <div class="grid_1">
                    &nbsp;
                </div>
                <div class="clear"></div>
                <div class="grid_6">
                    <div class="element">
                        <label>Comment</label>
                        <textarea name="comment" class="text textarea" style="width:427px;" rows="4"  /></textarea>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="grid_6">
                    <div class="element">
                        <input type="submit" id="submit" value="MAKE RESERVATION" />
                        <p>&nbsp;</p>
                    </div>
                </div>
            </form>


<script type="text/javascript">

$(document).ready(function() {

//if submit button is clicked
$('#submit').click(function () {        

    //Get the data from all the fields
    var name = $('input[name=name]');
    var email = $('input[name=email]');
    var phone = $('input[name=phone]');
    var address = $('input[name=address]');
    var city = $('input[name=city]');
    var zipcode = $('input[name=zipcode]');
    var service = $('input[name=service]');
    var datetime = $('input[name=datetime]');
    var passingers = $('input[name=passingers]');
    var comment = $('textarea[name=comment]');

    //Simple validation to make sure user entered something
    //If error found, add hightlight class to the text field
    if (name.val()=='') {
        name.addClass('hightlight');
        return false;
    } else name.removeClass('hightlight');

    if (email.val()=='') {
        email.addClass('hightlight');
        return false;
    } else email.removeClass('hightlight');

    if (address.val()=='') {
        address.addClass('hightlight');
        return false;
    } else address.removeClass('hightlight');

    if (city.val()=='') {
        city.addClass('hightlight');
        return false;
    } else city.removeClass('hightlight');

    if (zipcode.val()=='') {
        zipcode.addClass('hightlight');
        return false;
    } else zipcode.removeClass('hightlight');

    if (service.val()=='') {
        service.addClass('hightlight');
        return false;
    } else service.removeClass('hightlight');

    if (datetime.val()=='') {
        datetime.addClass('hightlight');
        return false;
    } else datetime.removeClass('hightlight');

    //organize the data properly
    var data = 'name=' + name.val() + '&email=' + email.val() + '&phone=' + phone.val() + '&address=' + address.val() + '&city=' + city.val() + '&zipcode=' + zipcode.val() + '&service=' + service.val() + '&datetime=' + datetime.val() + '&passingers=' + passingers.val() + '&comment='  + encodeURIComponent(comment.val());

    //disabled all the text fields
    $('.text').attr('disabled','true');

    //show the loading sign
    $('.loading').show();

    //start the ajax
    $.ajax({
        //this is the php file that processes the data and send mail
        url: "process.php", 

        //GET method is used
        type: "GET",

        //pass the data         
        data: data,     

        //Do not cache the page
        cache: false,

        //success
        success: function (html) {              
            //if process.php returned 1/true (send mail success)
            if (html==1) {                  
                //hide the form
                $('.form').fadeOut('slow');                 

                //show the success message
                $('.done').fadeIn('slow');

            //if process.php returned 0/false (send mail failed)
            } else alert('Sorry, unexpected error. Please try again later.');               
        }       
    });

    //cancel the submit button default behaviours
    return false;
}); 

});

many many thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:57:38+00:00Added an answer on June 9, 2026 at 9:57 am

    Your function is fine and is getting called if one uses your provided html above. But the site you gave link of shows this

    <input type="submit" value="MAKE RESERVATION" id="FormId">
    

    see that id=”FormId” it should be “submit”

    Ok now please try this

    1) Make sure you backup things
    2) Remove the validation function that we just added to index.html
    3) Replace the last script block (which starts from line 358) on index.html with the following

    <script type="text/javascript">
        $(document).ready(function () {     
        // Added by Prayas  (Start)
        function menuItemClick(section) {
            content1 = "loader.html " + section;
            toTheSky();
            $("#singleContentContainer").delay(400).fadeIn();
            $('#singleContentInside').load(content1);
    
    
              if(section=="#reservations")
                {
                        $('#submit').click(function(e) {
                        e.preventDefault();    
    
                        //Get the data from all the fields
                        var name = $('input[name=name]');
                        var email = $('input[name=email]');
                        var phone = $('input[name=phone]');
                        var address = $('input[name=address]');
                        var city = $('input[name=city]');
                        var zipcode = $('input[name=zipcode]');
                        var service = $('input[name=service]');
                        var datetime = $('input[name=datetime]');
                        var passingers = $('input[name=passingers]');
                        var comment = $('textarea[name=comment]');
    
                        //Simple validation to make sure user entered something
                        //If error found, add hightlight class to the text field
                        if (name.val()=='') {
                            name.addClass('hightlight');
                            return false;
                        } else name.removeClass('hightlight');
    
                        if (email.val()=='') {
                            email.addClass('hightlight');
                            return false;
                        } else email.removeClass('hightlight');
    
                        if (address.val()=='') {
                            address.addClass('hightlight');
                            return false;
                        } else address.removeClass('hightlight');
    
                        if (city.val()=='') {
                            city.addClass('hightlight');
                            return false;
                        } else city.removeClass('hightlight');
    
                        if (zipcode.val()=='') {
                            zipcode.addClass('hightlight');
                            return false;
                        } else zipcode.removeClass('hightlight');
    
                        if (service.val()=='') {
                            service.addClass('hightlight');
                            return false;
                        } else service.removeClass('hightlight');
    
                        if (datetime.val()=='') {
                            datetime.addClass('hightlight');
                            return false;
                        } else datetime.removeClass('hightlight');
    
                        //organize the data properly
                        var data = 'name=' + name.val() + '&email=' + email.val() + '&phone=' + phone.val() + '&address=' + address.val() + '&city=' + city.val() + '&zipcode=' + zipcode.val() + '&service=' + service.val() + '&datetime=' + datetime.val() + '&passingers=' + passingers.val() + '&comment='  + encodeURIComponent(comment.val());
    
                        //disabled all the text fields
                        $('.text').attr('disabled','true');
    
                        //show the loading sign
                        $('.loading').show();
    
                        //start the ajax
                        $.ajax({
                            //this is the php file that processes the data and send mail
                            url: "process.php", 
    
                            //GET method is used
                            type: "GET",
    
                            //pass the data         
                            data: data,     
    
                            //Do not cache the page
                            cache: false,
    
                            //success
                            success: function (html) {              
                                //if process.php returned 1/true (send mail success)
                                if (html==1) {                  
                                    //hide the form
                                    $('.form').fadeOut('slow');                 
    
                                    //show the success message
                                    $('.done').fadeIn('slow');
    
                                //if process.php returned 0/false (send mail failed)
                                } else alert('Sorry, unexpected error. Please try again later.');               
                            }       
                        });
    
                        //cancel the submit button default behaviours
                        return false;
                    });
        }
    
    
        }
    
        $("#services1").click(function() {
            menuItemClick("#services")
        });
        $("#services2").click(function() {
            menuItemClick("#services")
        });
        $("#rates1").click(function() {
            menuItemClick("#rates")
        });
        $("#rates2").click(function() {
            menuItemClick("#rates")
        });
        $("#reservations1").click(function() {
            menuItemClick("#reservations")
        });
        $("#reservations2").click(function() {
            menuItemClick("#reservations")
        });
        $("#fleet1").click(function() {
            menuItemClick("#fleets")        
        });
        $("#fleet2").click(function() {
            menuItemClick("#fleets")        
        });
    
        $("#closeContainer").click(function() {
            downToEarth();
            $("#singleContentContainer").fadeOut();
        });     
        // Added by Prayas  (End)
    });
    
    </script>
    

    EDIT 2

    1) Remove the Script block at the bottom that we just added.
    2) Copy the whole reservations div from loader.html into a new file named reservations.html.
    3) Place the original validation function in this div back on its position in “reservations.html”.
    4) Place this script block at the end of your index.html

    <script type="text/javascript">
        $(document).ready(function () {     
        // Added by Prayas  (Start)
        function menuItemClick(section) {
    
        if(section=="#reservations")
        {
                content1 = "reservations.html;
        }
        else
        {
                content1 = "loader.html " + section;
            toTheSky();
            $("#singleContentContainer").delay(400).fadeIn();
            $('#singleContentInside').load(content1);
        }
    
        $("#services1").click(function() {
            menuItemClick("#services")
        });
        $("#services2").click(function() {
            menuItemClick("#services")
        });
        $("#rates1").click(function() {
            menuItemClick("#rates")
        });
        $("#rates2").click(function() {
            menuItemClick("#rates")
        });
        $("#reservations1").click(function() {
            menuItemClick("#reservations")
        });
        $("#reservations2").click(function() {
            menuItemClick("#reservations")
        });
        $("#fleet1").click(function() {
            menuItemClick("#fleets")        
        });
        $("#fleet2").click(function() {
            menuItemClick("#fleets")        
        });
    
        $("#closeContainer").click(function() {
            downToEarth();
            $("#singleContentContainer").fadeOut();
        });     
        // Added by Prayas  (End)
    });
    
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Would anyone know why the bmlabel is not updated? and the log score shows
Would anyone know how to test for the appearance of a Toast message on
I am using double[] instead of NSArray. Would anyone know how to encode it
Would anyone one know if Apple has restrictions on providing a user feedback/bug report
Would anyone happen to know a trick that will keep this MSBuild task from
Does anyone know of a library that would allow me to manipulate Flex DOM
Does anyone know how I would go about changing (transforming) an image based on
Does anyone know a script which would wrap old Products namespace style Plone add-on
Does anyone know the display formatter that I would need to add to the
Does anyone know of a C# spell check library that would underline misspelled works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.