Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS What should I use for these advanced forms? Re: What should I use for these advanced forms?

#79007
ImpInaBox
Member

I’d start by having all form elements except those in step 1 hidden by CSS – display:none;

Then, having finished step 1 your visitor would hit a ‘next’ button or something with an onclick event that runs a piece of javascript to hide step 1 and make step 2 visible instead.

You could probably ease the programming burden by putting all the fields in step1 into their own div (or table or whatever) with the id ‘step1’ or ‘step2’ etc. Then the javascript boils down to something like…

function nextStep(nStep)
{
elStepLast = document.getElementById("step" + nStep - 1);
elStepNext = document.getElementById("step" + nStep);
elStepLast.style.display = "none";
elStepNext.style.display = "block";
}

Doing it in javascript rather than using separate forms on their own pages will make the form processing MUCH easier at the end.