SRL Archive - Web Development

help please :)


Shuttleu

2010-11-06 21:21:43

right i needed to split a form up into 6 parts (i have my reasons)

this is how it is split

now my problem is that when i hit the submit button i need it to submit forms 2, 4 & 6

i made this
<script type="text/javascript">
function submitFormsById(arFormsSubmit)
{
var formCollector = document.createElement("form");
with(formCollector)
{
method = "post";
action = "formfilled.php";
name = "formCollector";
id = "formCollector";
style.display = "none";
}

for(var ix = 0; ix<arFormsSubmit.length; ix++)
formCollector=appendFormVals2Form(document.getElementById(arFormsSubmit[ix]), formCollector);

document.body.appendChild(formCollector);
formCollector.submit();
}

function appendFormVals2Form(frmCollectFrom, frmCollector) {
var frm = frmCollectFrom.elements;
for(var ix = 0 ; ix < frm.length ; ix++)
frmCollector.appendChild(frm[ix]);
return frmCollector;
}
</script>

it works ok, apart from only every other field gets submitted

so if i have 4 text fields then text field 1 & 3 will be submitted, but 2 & 4 wont

does anyone know why every other field is submitted and not every field?

thanks in advance

~shut

EDIT: the code i am using to submit it is
<input type="button" Value="go" onclick="submitFormsById(Array('form1','form2','form3','form4'))"/>

Dynamite

2010-11-07 12:57:02

2.70£ to person who fixes :)

Shuttleu

2010-11-08 05:57:15

help is not needed any longer

~shut

Bobzilla69

2010-11-08 06:36:18

for people who want to know, you have to give each from a unique identifier and different name for the submit action, so that the code does not think click form 1's submit with forms 4's submit.

i will check my code when i find it and post it