meteor - How can I re-insert the values on a form, after a user clicks to edit something? -
i have single template that's wired show post if current user has post in collection. if not, automatically shows form.
now want add edit functionality. when user clicks on edit button,
- saves post text in variable.
- deletes post collection, template reactively reveals form again.
up part works. how can add text saved in variable, "input" element of form?
jquery works on console, don't know put in code.
on discover meteor, use router set context. i'd try idea jquery, if possible. thank you. suggestions welcome.
you keep post in session variable , in edit
click handler, set session variable 1 you're viewing.
in form inputs, can set value
attributes corresponding post values.
ex: <input name="title" value="{{post.title}}" />
and in template helper
template.form.helpers({ post: function() { return session.get('post') } })
Comments
Post a Comment