...

View Full Version : using the URL to control the # of textboxes



gogotina
12-29-2003, 05:08 AM
how can I change this code to have the URL link from the previos page control the nuber of textboxes? the sample Url is http://www.server.com/firstpage.html?Nmtxtbxs=5
If Nmtxtbx=5 then I want there to be

if(f.result5.value=="result5" && f.result4.value != "result4")
{f.result5.value = f.item_name.value;}
if(f.result4.value=="result4" && f.result3.value != "result3")
{f.result4.value = f.item_name.value;}
if(f.result3.value=="result3" && f.result2.value != "result2")
{f.result3.value = f.item_name.value;}
if(f.result2.value=="result2" && f.result1.value != "result1")
{f.result2.value = f.item_name.value;}
if(f.result1.value=="result1")
{f.result1.value = f.item_name.value;}

And if Nmtxtbx=2 then I want there to be

if(f.result2.value=="result2" && f.result1.value != "result1")
{f.result2.value = f.item_name.value;}
if(f.result1.value=="result1")
{f.result1.value = f.item_name.value;}

the code that I am using for each of the pages is this.

function moveData(f){
if(f.item_name.value != "total"){
if(f.result3.value=="result3" && f.result2.value != "result2")
{f.result3.value = f.item_name.value;}
if(f.result2.value=="result2" && f.result1.value != "result1")
{f.result2.value = f.item_name.value;}
if(f.result1.value=="result1")
{f.result1.value = f.item_name.value;}
}
for(m=0; m<f.elements.length; m++){
if(f.elements[m].type == "checkbox" || f.elements[m].type == "radio" && f.elements[m].checked){
f.elements[m].checked=false;
} }
f.item_1.value="";
f.item_2.value="";
f.item_name.value="";
}

A1ien51
12-29-2003, 02:22 PM
Either you dynamically write the code, or you loop through the form array elements instead of writing 5+ if statments.

Eric



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum