Created
June 5, 2014 17:11
-
-
Save hellvispresley/2369bb84060c6396c717 to your computer and use it in GitHub Desktop.
not returning input field data
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
<head> | |
<title>inTouch Phone Log</title> | |
</head> | |
<body> | |
<div class="entryfield"> | |
{{> entryfield }} | |
</div> | |
{{> display }} | |
</body> | |
<template name="entryfield"> | |
<input type="text" id="customer" placeholder="Customer" /> <input type="text" id="phone" placeholder="Phone#" /> <input type="text" id="location" placeholder="Location" /> <input type="text" id="note" placeholder="Notes" /> | |
</template> | |
<template name="display"> | |
<div> | |
<p> {{#each display}} | |
<strong>{{customer}}</strong>- {{phone}}- {{location}}- {{note}} | |
{{/each}} | |
</p> | |
</div> | |
</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
Display = new Meteor.Collection('display'); | |
if (Meteor.isClient) { | |
Template.display.display = function () { | |
return Display.find({}, {sort: { time: -1 }}); | |
}; | |
Template.entryfield.events = { | |
"keydown #phone": function(event, template) { | |
if(event.which == 13) { | |
var customer = $('#customer').val(); | |
var phone = $('#phone').val(); | |
var location =$('#location').val(); | |
var note = $('#note').val(); | |
if(customer != '' && phone != '' && location != '' && note != '' ) { | |
Display.insert({ | |
customer: customer, | |
phone: phone, | |
location: location, | |
note: note, | |
}); | |
customer = ''; | |
phone = ''; | |
location = ''; | |
note = ''; | |
} | |
} | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment