[1.5.6] Parent application question

Hi guys,

In my parent (root) handlers there is a Form.cfc handler that saves data into a database, and also in root/plugins I have the reCaptcha plugin.

  1. How can I call the plugin from a ContentBox layout to the parent root?
  2. When the Form.cfc saves the data, I need to redirect the user to the same page where the form exists displaying an error/success message (flash)
  3. When the form Submits (from ContentBox/layout to Root/handler) to Form.cfc method, the data is in request context (rc) right?

I try setting my plugin in root/handlers/Main.cfc but it seem that all methods in Main.cfc are being ignore by ContentBox.

Thanks

xerrano

That is because the handlers are in their corresponding modules.

I am not sure I understand the question, you have a layout theme that you wish to modify to show the captcha. Is this a custom page or are you hard coding the captcha into the view?

Or have you dropped ContentBox into an existing ColdBox application, trying to get the widget to work?

Anyway the CB helper or using widgets is what you need.

For example

#cb.widget(“widgetName”)#

Will then call up the widget for display, and render that into the view it was called from.

Thank you Andrew,

Ok, at the moment I have a Handler living in root, and a plugin (reCaptcha) which now is showing or working fine.
My problem at the moment is: when I submit the form to my root/handler from a layout in contentbox I need to redirect the user back to the same form page, but with the information of my form persisted into the rc

But at the moment when I use the setNextEvent(event=foo,persist=‘bar’) and try to drop rc.bar in my layout page… I get the error that the key ‘bar’ does not exist.

Any ideas?

Yes, that is because ContentBox doesn’t use those routes.

Any reason you are doing it that way?

Ok, I only want it to reuse a handler with a few methods already there. I have been re-using it on all my Coldbox sites

Thanks

xerrano

Without wrapping that handler into a module, you aren’t going to be able to run that unless you make changes to ContentBox to sit into an existing ColdBox application.

ok… that says it all.

That’s not accurate Andrew.

You can execute anything from the parent application but you must use the reserved “parent” route if ContentBox is in UI mode. This means you can do

/parent/handler/action

To any handler in your root appliction. Modules are different, they have their own entry point. But for handlers in your root “handlers” folder, you must use the “/parent” reserved route to execute this.

I use this all the time for form submissions, that’s actually how the store works in ortussolutions.com.

In your form you must store the location of where you are, you can do something like: event.getCurrentRoutedURL().

But you most definitely can submit to any root handler.

Damn… And the stupid thing is, that I do recall you adding this and forgot all about it :frowning: