我想使用quickform提交到服務器方法,我不認爲它的工作。當我按提交時,我放入方法中的console.log似乎不會被調用。流星Autoform:methodserver不叫
下面是我的問題的演示。 https://github.com/afifsohaili/quickform-demo
Server.js:
Volunteer = new Mongo.Collection("volunteer");
if (typeof Schema === "undefined") Schema = {};
Schema.volunteer = new SimpleSchema({
name: {
label: "Name",
max: 255,
type: String
},
birthdate: {
label: "Birthday/DD-MM-YYYY",
type: String
},
mobile_number: {
label: "Phone number",
type: String
},
email: {
label: "Email address",
type: "email"
},
facebook_url: {
label: "Facebook URL",
optional: true,
type: String
},
university: {
label: "University",
optional: true,
type: String
},
occupation: {
label: "Occupation",
optional: true,
type: String
},
male: {
autoform: {
class: "with-gap",
falseLabel: "Female",
trueLabel: "Male",
type: "boolean-radios",
},
label: " ",
type: Boolean
},
transport: {
autoform: {
type: "boolean-checkbox"
},
label: "I have my own transport",
type: Boolean
}
});
Meteor.methods({
registerVolunteer: function(doc) {
console.log(doc);
}
});
HTML:
<head>
<title>test-quickform</title>
</head>
<body>
{{> hello}}
</body>
<template name="hello">
<div class="row">
<div class="col s12">
{{> quickForm schema="Schema.volunteer" id="newVolunteerForm"
type="method" meteormethod="registerVolunteer"
buttonClasses="pink accent-3 waves-effect waves-light btn"
buttonContent="Continue" }}
</div>
</div>
</template>
注意:.scss具有依賴關係,只是刪除導入行並編譯。 –