website_form.js 701 B

1234567891011121314151617181920212223242526
  1. /**
  2. * Client code for the website_form template.
  3. *
  4. * - events
  5. */
  6. Template.website_form.events({
  7. "click .js-toggle-website-form": function () {
  8. $("#website_form").toggle("slow");
  9. },
  10. "submit .js-save-website-form": function (event) {
  11. // here is an example of how to get the url out of the form:
  12. const url = event.target.url.value;
  13. const title = event.target.title.value;
  14. const description = event.target.description.value;
  15. // put your website saving code in here!
  16. const doc = { url, title, description };
  17. Meteor._debug("Client trying to insert", doc);
  18. Websites.insert(doc);
  19. // Stop the form submit from reloading the page
  20. return false;
  21. }
  22. });