Jquery + bootstrap regexp for mobile number and phone number

Jquery + bootstrap regexp for mobile number and phone number

<!DOCTYPE html>
<html lang="en">

<?php
        include("dbcon.php");
        ini_set( "display_errors", 0);
        session_start();
?>

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Rivan IT Training Systems</title>

    <link rel="icon" href="img/rivan-logo.png" type="image/png">

    <!-- Bootstrap Core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="css/full-slider.css" rel="stylesheet">

    <!-- Bootstrap Validator -->


    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <![endif]-->


</script>

<style>
.container {
    background-color: #021B24;
    color: #fff;
    width:800px
    }
legend {
    color: #fff;
}
.form-control:focus {
    border-color: #fddbab;
    outline: 0; 
    -webkit-box-shadow: inset 0;
          box-shadow: inset 0;
    background-color: #fddbab;
}
.has-error .help-block {
    position:absolute;
    bottom: 10px;
    left: 80px;
    z-index: 20;    
    border: 1px #EEA236 solid;
    background-color: #f6cd94;
    line-height: 2em;
    padding: 1px 12px;
    border-radius: 4px 4px 4px 10px;
    -webkit-box-shadow: 7px 7px 5px 0px rgba(50, 50, 50, 0.75);
    -moz-box-shadow:    7px 7px 5px 0px rgba(50, 50, 50, 0.75);
    box-shadow:         7px 7px 5px 0px rgba(50, 50, 50, 0.75);
}
.difposhelpblock .has-feedback .form-control-feedback {
    top: 0px;
    right: 165px;
    display: none !important;
}
.difposhelpblock .has-error .help-block {
    position: absolute;
    left: 160px;
}
</style>



</head>

<body>

    <!-- Navigation -->
    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">
                    <img alt="Brand" src="img/rivanlogo-small.png" width="30px" height="30px">
                </a>
            </div>
            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li>
                        <a href="#">About</a>
                    </li>
                    <li>
                        <a href="#">Services</a>
                    </li>
                    <li>
                        <a href="#">Contact</a>
                    </li>
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container -->
    </nav>

    <!-- Full Page Image Background Carousel Header -->
    <header id="myCarousel" class="carousel slide">
        <!-- Indicators -->
        <ol class="carousel-indicators">
            <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
            <li data-target="#myCarousel" data-slide-to="1"></li>
            <li data-target="#myCarousel" data-slide-to="2"></li>
        </ol>

        <!-- Wrapper for Slides -->
        <div class="carousel-inner">
            <div class="item active">
                <!-- Set the first background image using inline CSS below. -->
                <div class="fill" style="background-image:url('img/bg.png');"></div>
                <div class="carousel-caption">
                  <h1>Training is the opposite of hoping.</h1>
                  <p>
                    Find out why this IT school is the reason why Many Filipino IT Professionals are working abroad. 
                    Learn Cisco CCNA-CCIE, VoIP, Linux, Fiber Optics.
                  </p>
                  <p><a class="btn btn-info btn-lg" href="" data-toggle="modal" data-target=".bs-example-modal-lg">
                    REGISTER NOW!</a></p>
                </div>
            </div>
            <div class="item">
                <!-- Set the second background image using inline CSS below. -->
                <div class="fill" style="background-image:url('img/2.jpg');"></div>
                <div class="carousel-caption">
                    <h2>Caption 2</h2>
                </div>
            </div>
            <div class="item">
                <!-- Set the third background image using inline CSS below. -->
                <div class="fill" style="background-image:url('img/3.jpg');"></div>
                <div class="carousel-caption">
                    <h2>Caption 3</h2>
                </div>
            </div>
        </div>

        <!-- Controls -->
        <a class="left carousel-control" href="#myCarousel" data-slide="prev">
            <span class="icon-prev"></span>
        </a>
        <a class="right carousel-control" href="#myCarousel" data-slide="next">
            <span class="icon-next"></span>
        </a>

    </header>

    <!-- Page Content -->
    <div class="container">

        <div class="row">
            <div class="col-lg-12">
                <h1>Full Slider by Start Bootstrap</h1>
                <p>The background images for the slider are set directly in the HTML using inline CSS. The rest of the styles for this template are contained within the <code>full-slider.css</code>file.</p>
            </div>
        </div>

        <hr>

        <!-- Footer -->
        <footer>
            <div class="row">
                <div class="col-lg-12">
                    <p>Copyright &copy; Your Website 2014</p>
                </div>
            </div>
            <!-- /.row -->
        </footer>

    </div>
    <!-- /.container -->


    <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg" style="width:800px">
        <div class="modal-content">
        <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Sign Up</h4>
        </div>
      
        <div class="container">
        <form class="form-horizontal" id="form_members" role="form">
        <br>
        <legend>Personal Information</legend>
        <div class="form-group">
            <div class="col-sm-4">
                <input type="text" class="form-control" name="lastname" id="lastname" placeholder="Last Name">
            </div>
            <div class="col-sm-4">
                <input type="text" class="form-control" name="firstname" id="firstname" placeholder="First Name">
            </div>
            <div class="col-sm-4">
                <input type="text" class="form-control" name="middlename" id="middlename" placeholder="Middle Name">
            </div>
        </div>
        <div class="form-group">
            <div class="col-md-4">
                <input type="text" class="form-control" name="nickname" id="nickname" placeholder="Nickname">
            </div>
            <label for="gender" class="col-sm-2">Gender</label>
            <div class="col-md-6"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          >
                <label class="radio-inline">
                <input type="radio" name="gender" id="male" value="male"> Male
                </label>
                <label class="radio-inline">
                <input type="radio" name="gender" id="female" value="female"> Female
                </label>
            </div>
        </div>
        <br>
        <div class="form-group">
            <div class="col-md-6">
                <input type="text" class="form-control" name="address" id="address" placeholder="Address">
            </div>
            <div class="col-md-6">
                <input type="date" class="form-control" name="birthday" id="birthday" placeholder="Birthday">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-4">
                <input type="number" class="form-control" name="phonenum" id="phonenum" placeholder="Phone Number">
            </div>
            <div class="col-sm-4">
                <input type="number" class="form-control" name="mobilenum" id="mobilenum" placeholder="Mobile Number">
            </div>
            <div class="col-sm-4">
                <input type="text" class="form-control" name="email" id="email" placeholder="Email Address">
            </div>
        </div>
        <hr width="70%">
        <div class="form-group">
            <div class="col-md-6">
                <input type="text" class="form-control" name="companyname" id="companyname" placeholder="Company Name">
            </div>
            <div class="col-md-6">
                <input type="text" class="form-control" name="designation" id="designation" placeholder="Designation">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-4">
                <input type="text" class="form-control" name="companyadd" id="companyadd" placeholder="Company Address">
            </div>
            <div class="col-sm-4">
                <input type="text" class="form-control" name="companycontact" id="companycontact" placeholder="Company Contact Number">
            </div>
            <div class="col-sm-4">
                <input type="text" class="form-control" name="companyemail" id="companyemail" placeholder="Company Email Address">
            </div>
        </div>
        <legend>Enrollment</legend>
        <div class="form-group">
            <div class="col-md-6">
            <select class="form-control" name="course_id" id="course_id">
            <option value="none">Select Course Code</option>

                <?php
                $mysql_subject = mysql_query("SELECT * FROM coursetb");
                while($row = mysql_fetch_object($mysql_subject)){
                      $coursecode = $row->course_code;
                      $courseid = $row->course_id;
                      echo "<option value=$courseid>".$coursecode."</option>";
                    }?>
            </select>
            </div>
            <div class="col-md-6">
            <select class="form-control" name="sched_id" id="sched_id">
            <option value="none">Select Schedule</option>

                <?php
                $mysql_subject = mysql_query("SELECT * FROM schedtb");
                while($row = mysql_fetch_object($mysql_subject)){
                      $sched = $row->date_from .' - '. $row->date_to;
                      $schedid = $row->sched_id;
                      echo "<option value=$schedid>".$sched."</option>";
                    }?>
            </select>
            </div>
        </div>
        <div class="form-group">
            <div align="center">
                <button type="submit" class="btn btn-success btn-lg" name="submit" id="submit" style="width:200px;">Submit</button>
            </div>
        </div>
        </form>
        </div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<!-- Include all compiled plugins (below), or include individual files as needed -->

<script>
$('#form_members').bootstrapValidator({
message: "This value is not valid",
feedbackIcons: {
        valid: 'glyphicon glyphicon-ok',
        invalid: 'glyphicon glyphicon-remove',
        validating: 'glyphicon glyphicon-refresh'
    },
fields: {
        lastname: {
            group: '.col-sm-4',
            validators: {
                notEmpty: {
                    message: 'A Last Name is mandatory'
                          }, // notEmpty
                    regexp: {
                        regexp: /^[A-Za-z\s.'-]+$/,
                        message: "Alphabetical characters, hyphens and spaces"
                    }
                        } // validators
                  },  // lastname
        firstname: {
            group: '.col-sm-4',
            validators: {
                notEmpty: {
                    message: 'A First Name is required'
                          }, // notEmpty
                    regexp: {
                        regexp: /^[A-Za-z\s.'-]+$/,
                        message: "Alphabetical characters, hyphens and spaces"
                    }
                        } // validators
                  },  // firstname
        middlename: {
            group: '.col-sm-4',
            validators: {
                notEmpty: {
                    message: 'A Middle Name is required'
                          }, // notEmpty
                    regexp: {
                        regexp: /^[A-Za-z\s.'-]+$/,
                        message: "Alphabetical characters, hyphens and spaces"
                    }
                        } // validators
                  },  // middlename  
        nickname: {
            group: '.col-md-4',
            validators: {
                    regexp: {
                        regexp: /^[A-Za-z\s.'-]+$/,
                        message: "Alphabetical characters, hyphens and spaces"
                    }
                } // validators
                  },  // nickname
        gender: {
            group: '.col-md-6',
            validators: {
                notEmpty: {
                    message: 'A choice is required'
                          } // notEmpty
                        } // validators
                  },  // gender
        address: {
            group: '.col-md-6',
            validators: {
                notEmpty: {
                    message: 'An Address is required'
                          }, // notEmpty
                        } // validators
                  },  // address
        birthday: {
            group: '.col-md-6',
            validators: {
                notEmpty: {
                    message: 'Date of Birth is required'
                          } // notEmpty
                        } // validators
                  },  // birthday
        phonenum: {
            group: '.col-md-4',
            validators: {
                    regexp: {
                        regexp: /^[1-9][0-9]{0,15}$/,
                        message: "Invalid Phone number"
                    }
                } // validators
                  },  // phonenum
        mobilenum: {
            group: '.col-md-4',
            validators: {
                    notEmpty: {
                    message: 'Mobile number required'
                          } // notEmpty
                    regexp: {
                        regexp: /^[1-9][0-9]{0,15}$/,
                        message: "Invalid Mobile Number"
                    }
                } // validators
                  },  // mobilenum 
        email: {
            group: '.col-sm-4',
            validators: {
                notEmpty: {
                    message: 'An Email Address is required'
                          }, // notEmpty
                emailAddress: {
                    message: 'This is not a valid email address'
                }         
                        } // validators
                  },  // email
        course_id: {
            group: '.col-md-6',
            validators: {
                notEmpty: {
                    message: 'Please indicate the course to take'
                          }, // notEmpty
                        } // validators
                  },  // course id
        sched_id: {
            group: '.col-md-6',
            validators: {
                notEmpty: {
                    message: 'Select a schedule'
                          }, // notEmpty
                        } // validators
                  },  // course id



} // fields
});
</script>

- Error on the highlighted texts. What should be changed?

    </div>
    </div>
    </div>














    <!-- jQuery -->
    <script src="js/jquery.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="js/bootstrap.min.js"></script>

    <!-- Script to Activate the Carousel -->
    <script>
    $('.carousel').carousel({
        interval: 5000 //changes the speed
    })
    </script>

</body>

</html>