Created
June 5, 2014 16:33
-
-
Save hellvispresley/a7d60c6b84e2ff30e233 to your computer and use it in GitHub Desktop.
Cant get a printout of my fields
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> | |
{{> entryfield }} | |
{{> 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="notes" placeholder="Notes" /> | |
</template> | |
<template name="phone"> | |
<input type="text" id="phone" placeholder="Phone #" /> | |
</template> | |
<template name="display"> | |
<p> {{#each customer}} | |
<strong>{{customer}}</strong>- {{phone}}- {{location}}- {{note}} | |
{{/each}} | |
</p> | |
</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