event setView and handlers

I am curious on something about event.setView(), if I call say

handlerA.methodA

Which sets a view that is like this

Event.setView(‘handlerB.methodA’);

Should this try to run the event handlerB.MethodA? I was under the impression that setView just loads the view not runs the handler/method am I wrong on that assumption?

setView will not run an event, but just point to a view.

IMHO you are confusing handler events with views… from the old documentation: “So when you set a view to render or you render a view, you basically only give it its name and path starting from the views directory they are contained on.”

So, if your view is: views/myCoolView.cfm, the call to setview would be Event.setView(“myCoolView”)

Am I missing something? Why are you mixing views with event handlers?

Pedro.

Its ok I found the problem, its the same problem that someone else discovered about runEvent in a handler.

Pedro, what you are seeing is not what you think. When creating views, the views are associated by their handler name and then the view name. So if you have HandlerB then the view will be stored in a directory called HandlerB, now in this case rather than create a whole new view that is duplicate code. I am loading that view up from the associated directory.

If that doesn’t make sense to you Pedro then, you may wish to learn how views and handlers work in relation to how they are stored as files. Or learn how to minimise files and maximise code reuse.

Now to the problem, I had a preHandler that would fire to check to see if that handler was ok to be run, in other words the user was signed in. But because this is using some older code that does a check on the event is certain events it was failing.

The reason was due to a runEvent() that was in the view itself, because the runEvent uses the currently called event, this was tripping this section of code up. Once I figured that out it was a case of mistaken events being run.

I’m still working with CB 2.6.4 and I haven’t used view autowiring much. I completely understand what you are saying, and where the problem was. Glad to see you could figure it out!

Pedro.