How to handle an event in a View file

9 views
Skip to first unread message

Daryl Jones

unread,
Nov 22, 2014, 7:55:09 PM11/22/14
to socket...@googlegroups.com
I'm new to Node and working on my first socketstream app. Progress is pretty good, but I'm stuck on what I'm sure is a simple problem.

I would like to handle a simple onchange event from a HTML 'select' that's defined in a views/app.html.  I defined a handler in client/code/app/app.js, however apparently not visible to app.html.

Here's what I have in client/code/app/app.js

var changeView = function(select) {
console.log('fired');
var selectedOption = select.options[select.selectedIndex];
alert("The selected option is " + selectedOption.value);
}
module.exports = changeView;

How can I have changeView handle the onchange event?

---

Paul Jensen

unread,
Dec 3, 2014, 10:06:29 AM12/3/14
to socket...@googlegroups.com
Hi Daryl,

Sorry for the long wait before replying. How are you passing the select tag to that function?

Regards,

Paul Jensen

Daryl Jones

unread,
Dec 3, 2014, 10:46:26 AM12/3/14
to socket...@googlegroups.com
Thank you for your reply.  The problem was a simple javascript scope problem. I eventually found and fixed the problem.  Socketstream is working great for me!



--




--
You received this message because you are subscribed to a topic in the Google Groups "SocketStream" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/socketstream/u-UxURZVcYw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to socketstream...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages