Create a simple module for calculating mortgage

Hi,

I’m a contentbox noob. I want create a simple form to calculate a loan mortgage.

I’d like to place a widget in the sidebar and then output the mortgage table on a single page.

I cannot find any tutorial out there to understand where starting from.

Please could you help me?

For a good starting place for modules you can always check out other modules to see how they are done, or browse

http://www.andyscott.id.au/blog/category/ContentBox

But for something like this, it would be as simple as any other ColdBox module. Work out what the widget is going to display and interact with ContentBox, and of course jQuery or JavaScript or ColdFusion Ajax to return data.

But without knowing your requirements, and what you want to achieve it could be hard to give you an exact starting point. But learning how modules, widgets and other things in ContentBox work.

I’ve made an attempt to build a simple widget to render form:

/**

  • Mortgage calculator
    */
    component extends=“contentbox.model.ui.BaseWidget”{

function init(controller){
// super init
super.init(controller);

// Widget Properties
setPluginName( “mortgage” );
setPluginVersion( “1.0” );
setPluginDescription( “Mortgage calculator” );
setPluginAuthor( “Francesco Pepe” );
setPluginAuthorURL( “http://” );
//setForgeBoxSlug( “” );
setCategory( “Finance” );
setIcon( “tune.png” );

return this;
}

/**

  • Render the widget out
    */
    any function renderIt(){
    // generate form
    saveContent variable=“rForm”{
    WriteOutput(’

Amount Tax Year

'); } return rForm; }

}

I get an error:
Error loading widget: Mortgage

Without any debugging info.

Where is the error occurring?

After a restart of railo the form is rendered and seems to be ok.

What I want now is a way to process the form. So I need a way to process the data.

How can I retrieve the data that are sent? They are in the rc variable? so I need a function to process the data?

Another question is: after a module change, I need to reinit the contentbox via fwreinit? the change are not visible after a simple page refresh…

If you have modules set to not always reload then yes, if you want, you can look at using configurations specific to your development and not production settings.

Sorry didn’t answer your other question. What you need to do now, use Ajax or standard calls to handlers to then do any server side processing.

Sorry if I abuse of your patience. I have another question.

If I add a widget to a page, for example mydomain.com/index.cfm/mortgage, how can I access this page programmatically?

I want insert in the form action the url of the page where the widget is, and insert also the widget in the sidebar, to make it acessible from the site entirely, but make the form result be processed from the mydomain.com/index.cfm/mortgage page.

Sorry, but the contentbox documentation is missing a lot of info.

Have you browsed my blogs on ContentBox? There is plenty of information on creating modules, widgets etc there.

In this case here, what you are really looking at doing is making it part of a module. Especially if you want to create widgets and have handler functionality as well as interceptors etc. Widgets are usually very good for displaying information without interaction with the server, this is not to say you can’t do that. It just means you need to write a module to do this anyway, or know that the module you widget is going to interact with is going to be installed.