コレクション以外のフォームに meteor-autoform を使用したい。このアプローチを試してみましたが、メソッドの戻り値を取得してクライアントに表示したいです。これを行う方法を教えてください。
これは私のスキーマです ( common.js ):
Schema = {};
Schema.echoSchema = new SimpleSchema({
echoText: {
type: String,
label: "Echo Text",
max: 50
}
});
これはクライアント(client.js)上の私のコードです:
Template.showEcho.helpers({
getEchoFormSchema: function() {
return Schema.echoSchema;
}
});
これはサーバー上の私のコードです(server.js):
Meteor.methods({
echoMethod: function (doc) {
check(doc, Schema.echoSchema);
return doc.echoText;
},
});
これは私のフォーム テンプレート ( showEcho.html ) です。
<template name="showEcho">
{{#autoForm schema=getEchoFormSchema id="echoForm" type="method" meteormethod="echoMethod"}}
<fieldset>
<legend>Echo Form</legend>
{{> afQuickField name="echoText"}}
<div>
<button type="submit" class="btn btn-primary">Submit</button>
<button type="reset" class="btn btn-default">Reset</button>
</div>
</fieldset>
{{/autoForm}}
<p>
// How To Show Echo Text HERE??
Text = ???????????????????
</p>
</template>