We've had to tackle similar issues with a VERY long form we broke up into
several sections, and carried the data along between sections as a WDDX
packet in a hidden field.
In this case sounds like you could do most of the job on the client
(browser) with a the tabs being an image map which swaps on and off the
visibility of a set of overlapping DIV boxes each with a different form,
then once you really want to submit you need to collect all the data from
all of these different forms into a JS object and serialise it into a WDDX
packet and save the result into one hidden form field on a top level form
and submit just this from with the single field - on the server side this
WDDX packet converts into a structure accessible with the same syntax as the
JS object.
HTH,
Noam
A cut down example just to show the principle of it:
var formWDDX = window.document.forms[0];
var form = window.document.forms[1];
var formData = new Object;
for (var i = 0;i < form.elements.length; i++)
{
fieldName = form.elements[i].name;
if (form.elements[i].type =="text" ||
form.elements[i].type =="textarea" || form.elements[i].type =="hidden" )
{
formData[fieldName] =
form.elements[i].value.Trim();
}
else if (form.elements[i].type =="select-one" &&
form.elements[i].selectedIndex > -1)
{//only take value if checked!
formData[fieldName] =
form.elements[i].options[form.elements[i].selectedIndex].value.Trim();
}
else if ((form.elements[i].type =="radio" ||
form.elements[i].type =="checkbox") && form.elements[i].checked)
{//only take value if checked!
formData[fieldName] =
form.elements[i].value.Trim();
}
else
{
//alert("name " + form.elements[i].name + "
type " + form.elements[i].type);
}
//alert("name " + fieldName + " val " +
formData[fieldName]);
}
wddxSerializer = new WddxSerializer;
formWDDX.Application_WDDX.value =
wddxSerializer.serialize(formData);
formWDDX.submit();
----------
From: Patrick McElhaney [SMTP:[EMAIL PROTECTED]]
Sent: Wednesday, 16 May 2001 17:42
To: Fusebox
Subject: Forcing Form Submit When Link is Clicked
I'm attempting to mimic the "tab" style interface
found in GUI apps on the web.
That is, I have several links at the top of the
page that point to various forms. The forms are
used to set different properties of the same
item.
It's basically a wizard, but I can jump to any
point in the wizard at any time. That's easy
enough, I know. Just use javascript to set a
hidden variable in the form to tell me which
tab was selected, submit the form, and at the
end of the submit fuseaction relocate to
the appropriate tab.
The real problem is that there won't always be
a form to submit. Or in some cases there will
be a form, but I won't want to automatically
submit it before going to the next tab.
I was wondering if anyone has ever dealt with
this type of problem before?
Patrick
----------------------------------
Patrick McElhaney <><
Intranet / Web Site Developer
American City Business Journals
704-973-1019 704-236-8351 (cell)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists