Flash Games

 FAQ   Search   Members   Groups   User Control Panel      Login 

It is currently Fri Jan 09, 2009 5:11 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Making a loop that changes field count
PostPosted: Sun Mar 04, 2007 7:36 pm 
Offline

Joined: Sun Feb 25, 2007 6:42 am
Posts: 5
I have a form that allows people to click 'Show More' and a second row pops up. The field is a drop dow populated by js. The problem I am having is assigning the new number to the js for drop list population. What I have so far is:

Code:
function showMoreWashers()
{
items+=1;
if (items < 12) {
document.getElementById('showMoreWashers').innerHTML += '<table border="0" width="100%" cellpadding="0" cellspacing="0" class="subTable"><tr><td><select name="washerA'+items+'"><Option value="" ></option></select></td><td style="padding-right: 1px;"><input class="num" name="washerqtyA'+items+'" type="text" value="" size=3></td><td style="padding-left: 2px;"><select name="washerB'+items+'"></select></td><td><input class="num" name="washerqtyB'+items+'" type="text" value="" size=3"></td></tr></table>';
}
else {
alert("Only 12 products can be compared!");   
}
for (var i=0; i < prodlist1.length;++i){
   addOption(document.ordform.washerA2, prodlist1[i], [i]);
}
for (var i=0; i < prodlist1.length;++i){
   addOption(document.ordform.washerA3, prodlist1[i], [i]);
}
for (var i=0; i < prodlist1.length;++i){
   addOption(document.ordform.washerA4, prodlist1[i], [i]);
}
for (var i=0; i < prodlist1.length;++i){
   addOption(document.ordform.washerA5, prodlist1[i], [i]);
}


... and so on...

But this populates each one before it.. so when 3 is populated, another set is added to 2. I need something like this:

Code:
addOption(document.ordform.washerA[items], prodlist1[i], [i]);


But the browser doesn't seem to like this!!! Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 05, 2007 3:11 am 
Offline

Joined: Sat Mar 03, 2007 4:40 pm
Posts: 32
Can you reformulate your question or put your thing online?
I don't understand


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 05, 2007 6:52 pm 
Offline

Joined: Sun Feb 25, 2007 6:42 am
Posts: 5
What I have is a form, with dropdowns for washerA1, washerB1. THey are populated with a javascript that is run when the page is opened:

Code:
addOption(document.ordform.washerA1, prodlist1[i], [i]);


And below is a link that adds another row with washerA2, washerB2... upt to 5 time (washerA5, washerB5)...

So, I have the code to populate each new dropdown:

Code:
for (var i=0; i < prodlist1.length;++i){
   addOption(document.ordform.washerA2, prodlist1[i], [i]);
}


Evertime a new row is added, the var washerCount is incresed to reflect the row number... the number in washerA2.

I am trying to use the var washerCount to populate the new droplist... instead of making a new call to the addOPtion function for each new row...

I will post a link as soon as I get it online![/code]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group - Flash Games - TNX Invitation Code - TNX Review

Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User:
Pass:
Log me on automatically each visit: