473,395 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Pass variable from drop down option field to text fields

Dan
Here is the working script if anyone is interested.

I was missing the else if.

<script language="JavaScript">
<!--

function Trip_Time(Traffic_Results) {
if (document.Traffic_Results.CIP_Diff.value == "point1") {
document.Traffic_Results.display_time.value = "2:20";
document.Traffic_Results.display_time2.value = "4:30"; }

else if (document.Traffic_Results.CIP_Diff.value == "point2") {
document.Traffic_Results.display_time.value = "8:20";
document.Traffic_Results.display_time2.value = "11:30"; }

else if (document.Traffic_Results.CIP_Diff.value == "point3") {
document.Traffic_Results.display_time.value = "1:20";
document.Traffic_Results.display_time2.value = "6:30"; }
else {
document.Traffic_Results.display_time.value = "0:00";

document.Traffic_Results.display_time2.value = "0:00";
}
}

// -->
</SCRIPT>
</HEAD>

<BODY BGCOLOR="white">

<form name="Traffic_Results">
<select name="CIP_Diff" onChange="Trip_Time()">
<option value="" selected>Choose from this list</option>
<option value="point1">Point 1</option>
<option value="point2">Point 2</option>
<option value="point2">Point 3</option>
</select>&nbsp;&nbsp;&nbsp; <font size="-1">Starting Location</font>
<BR>

Time at Location <input type=text name="reported_time" size=5 value=""><br>
ETA 1 <input type=text name="display_time" size=5 value="0:00"><br>
ETA 2 <input type=text name="display_time2" size=5 value="0:00">
Jul 23 '05 #1
2 1652
I'm doing the same thing in a page I'm working on right now, and it does NOT
work:
The text displayed in indeed updated.
But when the form is sent, it's the PREVIOUS contents of the text field that
are sent !?!
Same problem with IE6 and NS6.

Jean-François
Jul 23 '05 #2
Oops,

my mistake, the javascript work.
It's the php on the server side that was wrong.

JF
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

46
by: Kingdom | last post by:
In my data base I have a list of componet types e.g. type A - I have 8 off - type B I have 12 off etc. I'm using Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM Parts_Table") ...
4
by: dmiller23462 | last post by:
I'm trying to create a submission page for users to request PC/LAN Access....If they select "Yes" in the field asking about if they need Non Standard Software, I want several other HTML fields to...
2
by: ehm | last post by:
I am working on creating an editable grid (for use in adding, deleting, and editing rows back to an Oracle database). I have a JSP that posts back to a servlet, which in turns posts to a WebLogic...
11
by: Dan | last post by:
Hello all, I am getting records from a db and displaying the records to the user through a drop down menu in an asp page. Each record has 6 fields and I need to display them all to the user in...
5
by: EviL KerneL | last post by:
Hi - I am trying to figure out a way to enforce the validation included for this form based on whether the user chooses "email" or "phone" as the contact choice. Right now it is set to enforce...
4
by: Dan | last post by:
Can anyone offer suggestions on how to do this or if it is possible? I have a form that uses a drop down box and 2 text fields. What I am trying to do is have the value of each text box set by...
1
by: Dan | last post by:
This is one that has me stumped and I need an expert's input. Any ideas why the values from the second script-generated drop down list isn't recognized by the script to add time values to the...
19
by: nazgulero | last post by:
Hello all, I wonder if anybody can give me a hint about what I have to do to get this working: I am creating a drop down box using the script below. The result is two text fields; now I want...
2
by: giandeo | last post by:
Hello all, It's almost a couple of weeks since i am struggling to get this code work. Unfortunately, i am stuck. There seems to be no hope... Please Help....... I am working with an asp page...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.