Friday Forms Hell

admin

Administrator
Staff member
I have a page and I'm using this script to populate a textbox from a drop down menu:

<script language="JavaScript"><!--
function updateForm(what,count) {
selected = what.partnumber1.selectedIndex;

value = <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/what.partnumber1.options">http://www.webdeveloper.com/forum/archi ... r1.options</a><!-- m -->[selected].value;

for (var i = 0, oldpos = -1; i<count-1; i++) {
pos = value.indexOf('&',oldpos+1);
data = <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/value.substring(oldpos+1,pos">http://www.webdeveloper.com/forum/archi ... dpos+1,pos</a><!-- m -->);
what.elements['description' + i].value = value.substring(oldpos+1,pos);
oldpos = pos;
}
what.elements['description' + i].value = value.substring(oldpos+1,value.length)

}

//--></script>

Here is the URL of the Page: <!-- m --><a class="postlink" href="http://in.northern-tech.com/quote/test_quote.asp">http://in.northern-tech.com/quote/test_quote.asp</a><!-- m -->

This works for the first drop down menu and text box, but when I try to get the next dropdown menu in line to populate the next text box then the first drop down menu stops working. The is the code I used to get the second box working:

<script language="JavaScript"><!--
function updateForm(what,count) {
selected = what.partnumber1.selectedIndex;

value = <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/what.partnumber1.options">http://www.webdeveloper.com/forum/archi ... r1.options</a><!-- m -->[selected].value;

for (var i = 0, oldpos = -1; i<count-1; i++) {
pos = value.indexOf('&',oldpos+1);
data = <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/value.substring(oldpos+1,pos">http://www.webdeveloper.com/forum/archi ... dpos+1,pos</a><!-- m -->);
what.elements['description' + i].value = value.substring(oldpos+1,pos);
oldpos = pos;
}
what.elements['description' + i].value = value.substring(oldpos+1,value.length)

}

function updateForm(what,count) {
selected = what.partnumber2.selectedIndex;

value = <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/what.partnumber2.options">http://www.webdeveloper.com/forum/archi ... r2.options</a><!-- m -->[selected].value;

for (var i = 0, oldpos = -1; i<count-1; i++) {
pos = value.indexOf('&',oldpos+1);
data = <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/value.substring(oldpos+1,pos">http://www.webdeveloper.com/forum/archi ... dpos+1,pos</a><!-- m -->);
what.elements['adescription' + i].value = value.substring(oldpos+1,pos);
oldpos = pos;
}
what.elements['adescription' + i].value = value.substring(oldpos+1,value.length)

}


//--></script>

Here is the URL that used this code: <!-- m --><a class="postlink" href="http://in.northern-tech.com/quote/test_quote1.asp">http://in.northern-tech.com/quote/test_quote1.asp</a><!-- m -->

as you can see, the second drop down list now works but the first drowdown list stopped working. What am I doing wrong?
 
Back
Top