Event trigger based on 2 inputs


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);


We’ll need an example HTML output of this template to help further I think.

Although it might be worth trying e.currentTarget.


Here is the HTML: https://github.com/sscaff1/pedispace/blob/master/client/templates/shifts/shift_add.html
Here is the JavaScript: https://github.com/sscaff1/pedispace/blob/master/client/templates/shifts/shift_add.js


Will be the value of the changed drop down.

You’ll need to use a wider field selector to find the other value.




Perfect - thank you.