Created
March 4, 2015 01:21
-
-
Save ciwolsey/5df717d1ae5e895e6fcd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="basic_typehead"> | |
<form class="add-course"> | |
<div> | |
<div class="form-group"> | |
<input class="form-control typeahead" name="courses" type="text" | |
placeholder="Add a course" autocomplete="off" spellcheck="off" | |
data-source="getCourses"/> | |
<input type="submit" id="hide"/> | |
</div> | |
</div> | |
</form> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Template.basic_typehead.events({ | |
// I also tried with 'submit form' | |
'submit form': function (event) { | |
event.preventDefault(); | |
console.log("submit called"); | |
var text = event.target.text.value; | |
// insert the task into the database | |
Meteor.call("addCourseToUser", text); | |
// clear form | |
event.target.text.value = ""; | |
// Prevent default form submit | |
return false; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment