Multi Step Form

I am working on an estimate for a complete rewrite of an eCommerce application and I am stuck on something. The checkout process is made up of 4 steps

1.) Shipping & Billing
2.) Payment
3.) Review
4.) Results

Step 1:
First off I have never built a mutli step form in an MVC framework. I imagine its just like doing it without a framework though. Each form submits to a new step while saving the contents of the forms into a session variable. Any tips on this?

Step 2:
Based on the country they are coming from we need to present the forms a little different. First off billing and shipping addresses are completely different in Canada + UK then they are in the us. Right now we use the same x number fields but we just label them different based on the country. Countries have different shipping options / rules / pricing.

Basically I want to avoid what I did first time around (8 years ago) and have 1 form with a million <cfif session.co EQ “us”> etc… you get the idea. I know I haven’t really asked a question here but any tips on this?

When doing mutli step form I use a bean.

I would suggest u use the flash.persistRC method for that and if you need that data persistent in subsequent steps use the flash.keep method.

Cheers,
Tom

Also as for the different forms per country, why not detect the country in some way in your handler and then choosing a different view that holds the form according to the countries needs.

Cheers,
Tom

I actually wrote a Country Selector interceptor last night to handle the needs. Its weird because its not just figure out country and locale and be done with it. All countries except UK work off of the US catalog and therefor when displaying pricing needs to be in US locale.

That is not a bad idea though, I will have the country in the request context already so I could use that to drive the views.

When a variable becomes criticle to the flow of many areas of your site I would encourage you to take advantage of a RequestContextDecorator and add properties such as “country” or “language”. Within the INIT, assign your default values and just let the implict accessors do the work for you. Then, you’ll still have a clean “RC / PRC”.

-A

This is another one of the frameworks features that I need to learn! I will look into it, thanks Aaron

Simple example:

/** @hint Request Context Decorator enhances and augments the EVENT object in ColdBox. */
component accessors=“true” extends=“coldbox.system.web.context.RequestContextDecorator”
{
property name=‘Language_Long’ setter=false;
property name=‘Language_Short’ setter=false;
property name=‘Language_Medium’ setter=false;
property name=‘LID’ setter=false;
property name=‘i18nResource’;

public void function configure ()
{
// Custom setter that sets other props.
setLanguage(‘eng’);

return;
}

}