I am using AutoForm so users can submit posts and it will be dynamically routed to a URL using the AutoForm _id. I want to create a way to report a post now. I am looking for a way to make a new AutoForm that auto populates with the title of the post.
For example:
A user submits a post titled “cat” on success it redirects them to a URL called: http://websitename.com/posts/k5kcpoaHeeLrccNpR which displays the post.
at the bottom of the page there is a report this post link, it brings down a modal that has a AutoForm with reason to report.
It also auto populates the title “cat”
so far my schema looks as followed:
postReportsSchema = new SimpleSchema({
ID: {
label: "Title",
type: String,
autoform: {
options: function () {
return posts.find({}, {fields: {title: 1}}).map(function (c){
return {label: c.title, value: c._id};
});
}
}
},
reason: {
type: String,
allowedValues: ['copyright', 'plagiarism', 'spam or misleading'],
autoform: {
options: function () {
return _.map(['copyright', 'plagiarism', 'spam or misleading'], function (c, i) {
return {label: "Report " + i + ": " + c, value: c};
});
}
}
}
});
This works somewhat but the user has to manually select the title of the post I am looking for a way to automate it.
Any help is greatly appreciated.