So I have the following code. Basically I’m looking at the shiftType (which is a drop down menu) and startTime (which is a date-time input) and seeing if there is a change to either one. When there is a change, I’m going to the Rates collection and pulling the rate for that date and shiftType based on the current user’s location. The problem is I can’t seem to get the variables startTime and shiftType to evaluate to anything. If I comment out the lines in the query with those to variables, the event triggers fine and correctly logs my rate. Even if I just do console.log(startTime), it’s equal to null and I don’t understand. So if anyone can help, I’d appreciate it.
'change #shiftType, change #startTime': function(e) {
var startTime = $(e.target).find('[name=startTime]').val();
var shiftType = $(e.target).find('[name=shiftType]').val();
var r = Rates.findOne({
locationId: this.profile.locationId,
scheduleDate: startTime,
shiftType: shiftType
});
Session.set('rate', r.rateAmount);
console.log(Session.get('rate'));
}