我在Meteor Autoform中使用Jquery步骤,它与insetion表单配合得很好, 但是在初始化我的向导时,我的预填充字段变空了,我实际上可以看到我的字段已填满,然后在初始化向导时它们变空。
Template.editEmployee.rendered=function(){
// Initialize steps plugin
var form = $("#employeeEditForm");
form.validate({
errorPlacement: function errorPlacement(error, element) { element.before(error); },
rules: {
confirm: {
equalTo: "#password"
}
}
});
form.children("div").steps({
headerTag: "h3",
bodyTag: "section",
transitionEffect: "slideLeft",
enableContentCache: true,
preloadContent: true,
onStepChanging: function (event, currentIndex, newIndex)
{
form.validate().settings.ignore = ":disabled,:hidden";
return form.valid();
},
onFinishing: function (event, currentIndex)
{
form.validate().settings.ignore = ":disabled";
return form.valid();
},
onFinished: function (event, currentIndex)
{
form.submit();
}
});
}
这是我的模板:
<template name="editEmployee">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-md-12">
{{#autoForm collection='Meteor.users' doc=employee type='update' id='employeeEditForm'}}
<div>
<h3>Profile</h3>
<section>
{{> afQuickField name='profile'}}
</section>
<h3>Settings</h3>
<section>
{{> afQuickField name='userSettings'}}
</section>
</div>
{{/autoForm}}
</div>
</div>
</div>
</template>