如何构建引导表单验证?

时间:2016-05-22 02:27:18

标签: javascript forms twitter-bootstrap validation

我一直在尝试为我的回拨表单(仅限全名和电话号码)创建一个经过验证的表单,但不起作用。请问您如何更新JavaScript检查有效的INPUT信息?

我想要有效的全名格式,例如“名字姓氏”和英国电话号码格式作为有效信息,有效字段变为绿色(带有勾号),从而立即向用户反馈。请参阅下面的代码:

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

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link href="css/bootstrap.css" rel="stylesheet">
</head> 
    
<body>

<form method="post" action="php/call-back.php">
                        <div class="row">
                            <div class="col-lg-12 form-group">
                                <input id="name" type="text" name="name" placeholder="Enter your Full Name" class="form-control" required>
                            </div>
                            <div class="col-lg-12 form-group">
                                <input id="phone" type="tel" name="phone" placeholder="Enter your phone number" class="form-control" required>
                            </div>
                            <div class="col-lg-12 form-group">
                                <input type="hidden" name="save" value="contact">
                                <button type="submit" class="btn btn-default pull-right">Submit</button>
                            </div>
                        </div>
                    </form>
  
 <!-- JavaScript -->
 <script src="js/bootstrap.js"></script>
  <script src="js/jquery-1.10.2.js"></script>


</body>

</html>

非常感谢。

0 个答案:

没有答案