Forum Moderators: phranque

Message Too Old, No Replies

Link dynamic list box to text box on same form

Linking dynamic list box to text box on same form

         

bmatth1

1:00 am on Sep 2, 2003 (gmt 0)

10+ Year Member



I am having trouble linking one dynamic list box to a text field.
What I want to do is:

Use one recordset

When the value in one dynamic list box changes, update the value in another text box.
For example:
One dynamic list box will contain a list of dates in “August 4, 1999” format. Within the same record is another field with the date in another format “mm/dd/yyyy.” When the text format is selected in the list box, I would like the other text box to be updated with the corresponding “mm/dd/yyyy” format.

If there is another way of doing this, I am all ears.

Any help would be greatly appreciated

httpwebwitch

7:23 pm on Sep 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's a job for Javascript.
here's a hint. adapt it to your needs.

<form name="myform">
<select name="from" onChange="passvalue()">
<option value="05/05/05">05/05/05
<option value="06/06/06">06/06/06
<option value="07/07/07">07/07/07
</select>
<P><input type="text" name="to">
</form>

<script language="javascript">
function passvalue(){
document.myform.to.value=document.myform.from[document.myform.from.selectedIndex].value;
}
</script>

bmatth1

8:07 pm on Sep 2, 2003 (gmt 0)

10+ Year Member



Thank you, but I still cannot get it to work. When I change the value the list box, should the other box change immediately so that I can see the change? Here is the code:

function passvalue(){
document.form1.select2.value=document.form1.select[document.form1.select.selectedindex].value;
}

<td> <select name="select" onchange="passvalue()">
<%
While (NOT Weekof.EOF)
%>
<option value="<%=(Weekof.Fields.Item("dweekofvalue").Value)%>"><%=(Weekof.Fields.Item("dweekofvalue").Value)%></option>
<%
Weekof.MoveNext()
Wend
If (Weekof.CursorType > 0) Then
Weekof.MoveFirst
Else
Weekof.Requery
End If
%>
</select>&nbsp;

bmatth1

8:12 pm on Sep 2, 2003 (gmt 0)

10+ Year Member



Sorry, it works fine. I misread your example - it was very clear - my fault.
Thank you for your help.

bmatth1

8:23 pm on Sep 2, 2003 (gmt 0)

10+ Year Member



The text box changes to the value in the list box just fine. However, I would like to take another field within the same record and display this value, and store it.

The goal is to take the date, in text format as "August 10, 2003", and store it from one table, into another table field as date format: mm/dd/yyyy.

The first table has both formats, and I would like to use the date format in another table.

ANother option would be to convert the text field, as displayed in the first dynamic list box, into the date format, display the converted date in the other text field, and store this. IS this possible?

bmatth1

9:28 pm on Sep 2, 2003 (gmt 0)

10+ Year Member



Can you explain how do I obtain the "selectedindex" value? Will this give me the information in all fields within the selected record?
Thank you.