How to deal module handlers from root folder

Hi folks,

I’m new to Coldbox. I’m developing simple register application for this when user submit my registration form I needs to submit root/modules/users/handlers/main.cfc regsubmit().

how can I submit my page to above function from root/views/.\

Do I need to add Wirebox mappings for this. Please suggest me the best practice for this.

Thanks,
Siva

Can I make a suggestion, please read up on the MVC pattern.

But in a nutshell, when you send or request anything, it is handled through an Event Handler. This is the controller in the MVC pattern, in here you then provide the logic for what the handler needs to do.

For more information look into this

http://wiki.coldbox.org/wiki/EventHandlers.cfm

As well as this

http://wiki.coldbox.org/wiki/Models.cfm

These two links alone will get you started, once you have these basics down pat, you could then introduce things like

http://wiki.coldbox.org/wiki/Validation.cfm

HTH

He has an event handler named “main.cfc” and an event named “regsubmit.”

I think he’s looking for this…

Like Andrew mentioned, URL’s are handled by ColdBox’s routing engine. If you want to customize them, you add SES routes. On the other hand, WireBox mappings are used to create names to talk about objects. While useful, this has no bearing on public URL routing in your application.

In your module’s ModuleConfig.cfc the this.entryPoint is going to be the first part of your URL route. Let’s pretend you have this:
this.entryPoint = ‘users’;

So, your handler/action inside that module is “main.regsubmit”. When we put those together, we get this:

mysite.com/index.cfm/users/main/regsubmit

That is the full URL route to the regsubmit action in the main handler in the users module.

You can build it like so, which will automatically take care of the base URL, rewrites, etc:

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,

As you said I’m having this.entryPoint = ‘users’; for my users module .

I’m building link #event.buildlink(‘users/main/regsubmit’)# for my action page and it’s showing as http://localhost/Apps/index.cfm/users/main/regsubmit in my console

when I submit to this page this is redirecting to main.cfc(index) handler.

But I’m hitting below URL this is working fine.

http://localhost/Apps/index.cfm?event=users:main.regsubmit

FYI, http://localhost/Apps/index.cfm/sdfdgfgsgfsgf (event not in my app ) is also redirecting to main page.

Thanks for your help.

If you’re using a rewrite ISAPI, then you will need to remove the index.cfm in the routes.cfm file.

I think you’re missing this person’s questions, Andrew. Index.cfm exists in both of URL samples (both working and non-working).

@OP - Do you have any routes defined in your module config that would pick up main.regsubmit?