Click to See Complete Forum and Search --> : Transferring Info from a Form to an Array


jackalgirl
04-22-2003, 02:04 PM
I'm trying to make a form that lists Full name Date of birth and Gender, all entered by the user. I want to have the information displayed in an array once I click the Display button. How do I do that?

khalidali63
04-22-2003, 02:22 PM
something like this may help
<script type="text/javascript">
var dataArray = new Array();

//say yor form name is form1

var frm = documnet.form1;
var len = frm.length;
var ctr=0;
//now you only want text fields values
for(var x=0;x<len;x++){
if(frm[x].type=="text"){
dataArray[ctr++]=frm[x].value;
}
}

//now show all values in an alert
alert(dataArray);
</script>

Hope this points in right direction