parsley.js无法在我的Django表单验证中工作

时间:2016-02-06 08:31:50

标签: javascript html django parsley.js

Django中的此代码未显示任何验证错误。我错过了任何语法或标签吗?

<head>
    <link rel="stylesheet" type="text/css" href="/static/css/side_file.css">
    <script type="text/javascript" src="/static/js/parsley.js"></script>
    <link rel="stylesheet" type="text/css" href="/static/css/side_file.css">
    <script type="text/javascript" src="/static/js/parsley.js"></script>
</head>

<body>
    <form data-parsley-validate method="POST">
       {{form}}
    </form>
</body>

1 个答案:

答案 0 :(得分:1)

<head>
<link rel="stylesheet" type="text/css" href="/static/css/side_file.css">
<script type="text/javascript" src="/static/js/jquery.js"></script> # add jquery
<script type="text/javascript" src="/static/js/parsley.js"></script>
</head>

<body>
    <form data-parsley-validate method="POST">
       {{form}}
    </form>
</body>