Set up a form component(Flow Components) that is used for a parent-child type of object but only works as the parent?


#1

So I’m using Flow Components/Router to to build my app and I’ve set up a component that handles the creation of a new event. I also want to be able to set up events inside events so the parent event needs to pass its ID to the child. I think the issue is that when I submit the form for the child it still tries to pull values from the parent form.

I currently have it set up so that when you create an event the “parent” is set to null. If you’re inside that event you can create a child event and it passes the parent ID to the child and populates a hidden field. I’ve got that all working, but for some reason when I submit the form in the child event it doesn’t populate the “name” or “parent” (the only fields currently setup). So I need to fix the form so that it looks for values only in “this” form, but I’m not sure how to do that. Hopefully someone can help.

Template['sceneCreate'].events({
"click #create-scene": function(e) {
    e.preventDefault();
    var props = {
        "title": $('.scene-name').val(),
        "parent": $('.parent-scene').val()
    }
    FlowComponents.callAction("create", props);
}
});

sceneFormComponent.action.create = function(props) {
console.log(props);
var scene = Scenes.insert(props);
FlowRouter.go('/s/' + scene);
};