Skip to content

Instantly share code, notes, and snippets.

@hellvispresley
Created June 5, 2014 17:11
Show Gist options
  • Save hellvispresley/2369bb84060c6396c717 to your computer and use it in GitHub Desktop.
Save hellvispresley/2369bb84060c6396c717 to your computer and use it in GitHub Desktop.
not returning input field data
<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>
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