Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with a Selects onSelect

Status
Not open for further replies.

BatGrrrL

Programmer
Jan 21, 2003
12
AU
Hi,

Can someone please tell me where I'm going wrong here.

I'm making my own bill payment system in asp. A Select box is filled with the Names of the Billers.
<option value=&quot;<%= rs( &quot;BillerID&quot; ) %>&quot;><%= rs( &quot;BillerName&quot; ) %></option>
And hidden field is assigned a biller reference code.

<input type=&quot;hidden&quot;name=&quot;BR<%= rs( &quot;BillerID&quot; ) %>&quot; value=&quot;<%= rs( &quot;BillerRef&quot; ) %>&quot;>

So the BillerID is dynamic for each record, and the BR hidden field is dynamic too.

I would like a select box onChange event that changes an input box &quot;BillerRef&quot; to be equal to the corresponding hidden BR(ID) value.

Is there a way to get this statement (from my select box):
onChange=&quot;document.addBill.BillerRef.value= document.addBill.BR1.value;

to Be:
onChange=&quot;document.addBill.BillerRef.value= document.addBill.BR*ID OF SELECTED OPTION*.value; ?

The closest I've come is this, but I don't think it gets the options value properly (too many []s?)
onChange=&quot;document.addBill.BillerRef.value= document.addBill.BR[this.options[this.options.selectedIndex].value].value;

Any help would be appreciated!

Cheers
Batty

Sorry about the long winded question, I just like to give as much info as possible.
 
Ohh Solved:

<script language=&quot;JavaScript&quot;>
<!--
function popRef(BillerID)
{
var BID;
BID = BillerID.options[BillerID.options.selectedIndex].value;

var Brow;
Brow = eval(&quot;document.addBill.BR&quot; + BID + &quot;.value&quot;);
document.addBill.BillerRef.value = Brow;
}
-->
</script>

<select name=&quot;BillerID&quot; id=&quot;BillerID&quot; onChange=&quot;popRef(this)&quot;>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top