473,326 Members | 2,133 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,326 software developers and data experts.

dropdown menu that changes values in subsequent fields

Hi all, I am looking for some event handler auto-calc help on a form that
takes user input through text fields and dropdown menus. I would like some
of the text fields to be auto populated when dropdown menu selections are
made. Here is an abstract html/javascript form:

<form>
Enter how much money you are willing to spend:<input type=text name=amount
size=10>
Enter your home city:
<select name=city>
<option selected value=0>Choose city:</option>
<option value=ny>New York</option>
<option value=la>Los Angeles</option>
</select>

Enter what you want to buy:
<select name=type>
<option selected value=0>Choose type:</option>
<option value=car>Car</option>
<option value=moto>Motorcycle</option>
</select>

<script = javascript>
<!-- This is where the javascript computations will be - this is not full JS
code but what would be needed --!>
var car=15000
var moto=7000
var ny_fees= .10
var la_fees= .07

if (city = ny) and (type = car) {
populate the "total" field with the computation of: total = (car + (car
* ny_fees));
} else if (city = la) && (type = car) {
populate the "total" field with the computation of: total = (car + (car
* la_fees));
} else {
city is not ny or la and total is just the total
}
final_amount = amount - total_fees;
<!-- All computations will be calculated via an event handler (pehaps an
"onchange" handler?) on the dropdown menu(s) --!>
</javascript>

This is the total that you will pay: <input type=text name=total size=10>

This is how much money you have remaining:<input type=text name=final_amount
size=10>
</form>
<!-- end of code --!>

Explanation: So, what will be auto calculated is the "final_amount" and
"total" fields based on the two drop down menu selections above. The form
data will then be sent to a cgi form processing script.

Any ideas? Thanks in advance!

Mosher
Jul 23 '05 #1
1 1724
Mosher wrote:
Hi all, I am looking for some event handler auto-calc help on a form that
takes user input through text fields and dropdown menus. I would like some
of the text fields to be auto populated when dropdown menu selections are
made. Here is an abstract html/javascript form:


Have a look through Matt Kruze's stuff here:

<URL:http://www.mattkruse.com/javascript/dynamicoptionlist/>

[...]

--
Rob
Jul 23 '05 #2

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

Similar topics

1
by: middletree | last post by:
For an ASp Intranet app, I have some code that should work, but I am not able to make it happen for some reason, after spending considerable time on this. I am pretty thick when it comes to...
4
by: Doslil | last post by:
I have a form which has a subform.In the main form I have only one field (this is a drop down list and has a query attached to it) which selects empno,Name from the EmployeeInformation table. ...
1
by: Paul Eason | last post by:
I have identified a re-creatable issue that may be a bug and may be by design? I have a Webform with two dropdown lists on it, each with a different name and different tab index but they both...
2
by: PJSimon | last post by:
I have a system tray icon for my application. Each time the user pastes some text into the application, I add a submenu item in the system tray's context menu. The first time I right-click the icon...
3
by: balu435 | last post by:
Hi friends, I have an (VBA) application which programatically fills the values in a web page. In the web page there is a dropdown menu whose options are selected during run-time by using a...
0
by: Shashank | last post by:
Hi all, I have made a toolbar in c# using toolstrip control. I am using xml file to generate menu at runtime and then binding it to the dropdown button. My problem is that when I click the...
8
by: jmartmem | last post by:
Greetings, I have an Dreamweaver CS3 ASP page (profile.asp) in which project management users can update project information presented in a Record Update Form. I have three menu form fields ("FY",...
19
by: Jim | last post by:
Hi, I have two questions/problems pertaining to CSS horizontal dropdown menus and am hoping that someone here can help me out. (1) I'm having a problem centering the menu. I picked up the...
4
by: Paul | last post by:
Hi all, I have a page that has a form on it which has a dropdown list on it. It connect to an sql database and populate the list. What I would like to do is make the list editable so that if the...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.