Can't get setNextEvent() to work

Is there a test.cfm view as the missing include says there isn’t.

Hi Andrew

No, there is no /views/Administration/test.cfm template. The controller function Administration/test merely does some processing (ommitted for simplicity) and then is meant to relocate.

Then there is your issue, setNextEvent() sets the next event to run at the end of the processing, it then requires the view to exist. There is another option needed something like NoRenderView or something, to do what it is you’re looking at doing.

component name="general"{

	function saveData(event,rc,prc){
		// do your work here …..

		// set for no render
		event.noRender();
	}

}

Hi Andrew

I already tried that. If I set up a test.cfm view and run the handler, it of course goes to the view. If I then add event.noRender() it simply renders nothing. In both cases, it’s still just ignoring the setNextEvent() function which is the actual problem.

Show us the function that contains the redirect. Also what patch level is your CF9 server. There is one bug I know about that will literally skip over a line of code on CF9.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

This is not true Andrew. SetNextEvent() performs an immediate relocation. Please see the link to GitHub I provided in an earlier post.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Hi Brad

The function is this one. It’s totally empty apart from the setNextEvent() function:

function test(event, rc, prc) {
//setNextEvent(“Administration.locations”);
//setNextEvent(event=“Administration.locations”);
setNextEvent(event=“Administration/locations”);

}

We are on: ColdFusion Server Enterprise 9,0,1,274733

Hmm, that looks ok. What happens if you put a dump/abort before and after that call. If the abort after is getting hit, then step into the setnextevent function (in the Coldbox controller) and see why the cflocation isn’t firing.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

This function:

function test(event, rc, prc) {
var xxx = “yyy”;
writedump(xxx);
setNextEvent(event=“Administration.locations”);
xxx = “zzz”;
writedump(xxx); abort;
}

Produces
yyy zzz

So we can see that setNextEvent() is being totally ignored.

step into the setnextevent function (in the Coldbox controller) and see why the cflocation isn’t firing

Err… how do I do that? (Using CFEclipse IDE)

Err… how do I do that? (Using CFEclipse IDE)

Heh, no just move your dump/abort inside the first line of the setNextEvent() function :slight_smile: I sent a link to where it is in the 3.6.0 source code earlier in this thread. It’s in the Controller.cfc.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Hi Brad

Nothing. Zip, Nada!

I dropped a dump/abort into the top of the sendRelocation() function and re-initialised Coldbox. Hitting the test function I still get my yyy zzz output like before. I even dropped a simple error into the sendRelocation() function so that it would break, but it made no difference.

The only conclusion I can draw is that my application seems to simply not know what to do with the setNextEvent() function and just walks right on past it.

Is there a way to check or verify which Coldbox functions are turned on or turned off? Is that even a thing in ColdBox???

Brad - Yeah I kinda of forgot that, been awhile.

Michael - What version of ColdFusion are you using?

More info…

Okay, I have other CB applications on the same server, using the same CB framework code. I just inserted the same test() function into one of the other application’s handlers and setNextEvent() works entirely as expected(!)

So, it’s not CB that’s the problem, it must be something in my application itself.

What could I possibly have done that would ‘disable’ setNextEvent()?
Should I post my config file(s)?

To be honest, I think you’re hitting a known CF9 but that can skip lines of code. Normally it looks different on your screen and happens when you pass object literals into function calls. Can you verify that you have the latest CF9 updates installed?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Hi Brad

No, I can only verify that we do not have the latest hotfix(!) My server admin tells me they will apply it next Tuesday.

Do you expect it to make a difference?

Honestly I don’t recall what versions it was fixed in. Here’s a blog talking about the issues I’m remembering:

http://brien-malone-web-dev.blogspot.com/2014/08/coldfusion-901-bug-function-executes.html

I would recommend installing the “Lucee” patch to your CF9 server :slight_smile:

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Hi Brad (et al)

All hotfixes have now been applied. The problem still persists :frowning:

This is either something really stupid, eg. something in my config, or something pretty serious.

To recap,

  • It’s not a server issue, because setNextEvent() works on other applications on the same server.

  • And it’s not a Coldbox issue, because setNextEvent() works on other applications on the same server using the same Coldbox code.

  • So it must be something inside this application itself.

Where to look next…?

Michael,

Instead of putting writedumps in the SendRelocation function Brad mentioned maybe try stepping thru the SetNextEvent function itself (is in same cfc)? It calls sendRelocation at the bottom…

Hi Irvin

I aborted right at the top of setNextEvent() in the Controller.cfc, then:

This function:

function test(event, rc, prc) {
var xxx = “yyy”;
writedump(xxx);
setNextEvent(event=“Administration.locations”);
xxx = “zzz”;
writedump(xxx); abort;
}

Produces
yyy zzz

So, it’s exactly the same result. setNextEvent() simply doesn’t even fire.