RunEvent problem

Upon submitting the form I need to be redirecting to the handler which will use runEvent and execute another function. I’ve been doing this all over. But now when the handler is called it tells me that cannot find the view. But I do not have a view it simply a processing page. If I put SetNextEvent then it works but then I am losing all form variables that I just submitted.

Please advice

Thank you

Hi Erik,

you could try adding:

return;

at the end of function so it doesn’t implicitly try to render the view or if using setNextEvent use:

flash.persistRC(include=“varname1,varname2,etc”);

to persist the variables to the next request.

Nolan

Here is my handler once the form get submitted. And I do xhave a dynamic form so I do not know number of fields in advanced

var rc = event.getCollection();

if (StructKeyExists(rc,“submit1”)) {
runEvent(‘handler.function1’);
}else if(StructKeyExists(rc,“submit2”)) {
runEvent(‘handler.function2’);
}else if(StructKeyExists(rc,“submit3”)) {
SetNextEvent(‘handler.backFunction’);
}

did you try adding:

return;

to the end of the function?

Also,

If you don’t know the fields that are being passed then you may be able to do something like:

var formfields = {
	stuffpassedinRC = rc
};

// put all the variables in flash scope
flash.putAll(formfields);
setNextEvent('handler.backFunction');
More reference here:  [http://wiki.coldbox.org/wiki/FlashRAM.cfm](http://wiki.coldbox.org/wiki/FlashRAM.cfm)
Nolan

All handlers will try to run a view, unless you add this to the end of it.

event.noRender();

I just did the return and it does not work. Let try another suggestion

This is working. great. Thank you. However, in my previous project I did not use it and it was working just fine

Did you try Andrew’s suggestion?

event.noRender();

Yes I did and it works

If I recall right this was added in CB2.6.x you might have been using an older version again.

I am using ColdBox 3.0.0 RC2