我想创建一个简单的验证来要求名称(稍后会添加更多的验证)。该应用程序是一个烬应用程序,我们想要使用jquery validation。如何正确使用emberjs上的jquery-validation?
我有麻烦只是为了得到一个基本的验证运行。这是我有:
//index.html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script>
...
//body and such//
...
<script>
$('#salesForm').validate();
</script>
</body>
一个组件内,说销售形式:
//app/components/sales-form/template.emblem
form id="salesForm"
...
.form-group
label Some Sales Info
= input type="text" disabled=false value=salesNumber placeholder="Sales Number" class="form-control" required
button{action: 'clickNSave'}
...
这给了我一个编译错误,因为标志并不输入识别required
。
如何创建一个简单的验证使用jquery-validation在模板上使用emblem的应用程序应用程序?
附加问题,我的验证index.html
是否正确,在关闭body标签之前在最后运行验证?如果没有,插入$('#someForm').validate();
的最佳方法在哪里?