Retaining form values inside the display of select pulldown boxes

C

cgplays.com

I have a select-pulldown at http://computergroupplays.com/fb-pres2.asp
that changes the 3rd pulldown (Dbase) depending on what the user
enters in the 2nd (Wk). My associate wants the values inside the
select box to retain their values after hitting the Go-Submit button
when selecting the 3 choices- they want to see the values retained on
the next page when you look at the form. Below is the include file
used to generate the dynamic pulldown value for the 3rd pulldown:

<script language="Javascript">

var arrayData = new Array();

arrayData[0] = '1|LY-YrToDate|'
arrayData[1] = '1|LY-Last8wk|'
arrayData[2] = '2|LY-YrToDate|'
arrayData[3] = '2|LY-Last8wk|'
arrayData[4] = '3|Avg(YrTD-LY)|'
arrayData[5] = '4|YrToDate|'
arrayData[6] = '5|YrToDate|'
arrayData[7] = '6|YrToDate|'
arrayData[8] = '7|YrToDate|'
arrayData[9] = '8|YrToDate|'
arrayData[10] = '8|Rolling-6wk|'
arrayData[11] = '9|YrToDate|'

function populateData( name ) {

select = window.document.form.DBCode;
string = "";

// 0 - will display the new options only
// 1 - will display the first existing option plus the new options

count = 0;

// Clear the old list (above element 0)

select.options.length = count;

// Place all matching categories into Options.

for( i = 0; i < arrayData.length; i++ ) {
string = arrayData.split( "|" );
if( string[0] == name ) {
select.options[count++] = new Option( string[1] );
}
}


}

</script>

===
.....and the html in the form:


<form name="form" method="post" action="fb-query-post6.asp">


<td height="114" valign="top"
background="images/wayback.jpg" width="359"><p><br>
&nbsp;&nbsp;<br>
&nbsp;</p>
<p> &nbsp;<font color="#FF9900" size="2">Yr</font>
<select name="season" STYLE="font-family : monospace;
font-size : 7.5pt"><option></option>
<option value="2003">2003</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
</select>
<font color="#FF9900" size="2">Wk#</font>
<select name="gameweek" size=1 STYLE="font-family :
monospace;
font-size : 7.5pt"
onChange='javascript:populateData(
this.options[selectedIndex].text )'>
<option></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>

</select>
&nbsp; <font color="#FF9900" size="2">DBase
<select name="DBCode" STYLE="font-family : monospace;
font-size : 7.5pt">
</select>
&nbsp;<input name="submit" type="submit" class="inputSubmit"
value="Go" size="8" align="absbottom">
</form>



using option value "selected" gives this scenario problems. Any remedy
into what I'm suggesting, or is it possible?

thx
Cgplays.com
 
P

Pachydermitis

I have a select-pulldown at http://computergroupplays.com/fb-pres2.asp
that changes the 3rd pulldown (Dbase) depending on what the user
enters in the 2nd (Wk). My associate wants the values inside the
select box to retain their values after hitting the Go-Submit button
when selecting the 3 choices- they want to see the values retained on
the next page when you look at the form. Below is the include file
used to generate the dynamic pulldown value for the 3rd pulldown:

Perhaps I missed something you asked but in case I didn't:
You have a function that changes the value of Dbase when Wk selected.
Pass the value of Wk to the 'next page.'
Include the function (that changes Dbase) in the 'next page' and run
it when the page opens. It will then set Dbase on the 'next page' the
same way it did on the first page because you are passing it the same
value you did the first time.
HTH
Pachydermitis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top