473,385 Members | 1,817 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,385 software developers and data experts.

Auto Populate Text Box

Hello:

I have a registration form for classes. Each class has a fee. I have a
drop down box whereby the user chooses his class. There is a textbox with
the associated fee. I would like to auto populate the fee textbox depending
on what class the user chooses. In the email, the value of the drop down
box has to be the name of the class and the value of the fee text box has to
be the fee. Can someone please help me in accomplishing this? Thank you.

David
Jul 20 '05 #1
2 18039
Lee
C. David Rossen said:

Hello:

I have a registration form for classes. Each class has a fee. I have a
drop down box whereby the user chooses his class. There is a textbox with
the associated fee. I would like to auto populate the fee textbox depending
on what class the user chooses. In the email, the value of the drop down
box has to be the name of the class and the value of the fee text box has to
be the fee. Can someone please help me in accomplishing this? Thank you.


You may not really want to do that.
It would be trivial to hack your page to make it send your
form with whatever class one wants, and whatever price they
choose to pay for it. And I really hope you're not asking
people to send personal/financial information through email.

However:

<html>
<head>
<script type="text/javascript">
function populate(item){
for(var i=0;i<item.form.elements.length;i++){
if(item==item.form.elements[i]){
item.form.elements[i+1].value=
item.options[item.selectedIndex].value;
}
}
}
</script>
</head>
<body>
<form>

<select onchange="populate(this)">
<option value="">--none--</option>
<option value="2.50">alpha</option>
<option value="1.95">beta</option>
<option value="3.00">gamma</option>
</select>
<input type="text"><br>

<select onchange="populate(this)">
<option value="">--none--</option>
<option value="2.50">alpha</option>
<option value="1.95">beta</option>
<option value="3.00">gamma</option>
</select>
<input type="text"><br>

<select onchange="populate(this)">
<option value="">--none--</option>
<option value="2.50">alpha</option>
<option value="1.95">beta</option>
<option value="3.00">gamma</option>
</select>
<input type="text"><br>

</form>
</body>
</html>

Jul 20 '05 #2
Lee:
Here is the problem. I need the value of the class (alpha, beta or gamma)
to be just that in the email, not the fee amount. So, my question is is
there a way to populate the fee text box with the number while maintaining
the value of the name of the class? Thanks.

David

"Lee" <RE**************@cox.net> wrote in message
news:bk*********@drn.newsguy.com...
C. David Rossen said:

Hello:

I have a registration form for classes. Each class has a fee. I have a
drop down box whereby the user chooses his class. There is a textbox withthe associated fee. I would like to auto populate the fee textbox dependingon what class the user chooses. In the email, the value of the drop down
box has to be the name of the class and the value of the fee text box has tobe the fee. Can someone please help me in accomplishing this? Thank
you.
You may not really want to do that.
It would be trivial to hack your page to make it send your
form with whatever class one wants, and whatever price they
choose to pay for it. And I really hope you're not asking
people to send personal/financial information through email.

However:

<html>
<head>
<script type="text/javascript">
function populate(item){
for(var i=0;i<item.form.elements.length;i++){
if(item==item.form.elements[i]){
item.form.elements[i+1].value=
item.options[item.selectedIndex].value;
}
}
}
</script>
</head>
<body>
<form>

<select onchange="populate(this)">
<option value="">--none--</option>
<option value="2.50">alpha</option>
<option value="1.95">beta</option>
<option value="3.00">gamma</option>
</select>
<input type="text"><br>

<select onchange="populate(this)">
<option value="">--none--</option>
<option value="2.50">alpha</option>
<option value="1.95">beta</option>
<option value="3.00">gamma</option>
</select>
<input type="text"><br>

<select onchange="populate(this)">
<option value="">--none--</option>
<option value="2.50">alpha</option>
<option value="1.95">beta</option>
<option value="3.00">gamma</option>
</select>
<input type="text"><br>

</form>
</body>
</html>

Jul 20 '05 #3

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

Similar topics

1
by: Jason Galvin | last post by:
I would like to disable the auto-populating feature (remembers form element text between post-backs) when creating a .NET form. I have succeeded in disabling auto-populate by creating my controls...
1
by: Jim | last post by:
I have a new database in which I have a form where in one field I type a letter A, B, C or D and the field next to it autofills (auto lookups) with a description associated with the specific...
3
by: jacklindsay | last post by:
Hello smarter people than me I am creating a database for college, and have requested some help, but they are unable to help me. ( im obviously too eager) anyway, im creating a database on...
42
smiley22
by: smiley22 | last post by:
javascript. i had a code like this, which add a rows in a table, with an inputtext and a button in each row. i want to know how will i do this scenario: that when i add 5 'tdOrdersSerial' and 5...
4
by: whamo | last post by:
I have the need to populate a field based on the selection in a combo box. Starting out simple. (2) tables tbl_OSE_Info and tbl_Input; tbl_OSE_Info has three fields: Key, OSE_Name and OSE_Wt...
5
by: kalboako1987 | last post by:
hello guys Im trying to autopopulate my form from a table in my database called Enrollment.it will fill the textboxes in my form whenever the id number typed in the textbox is existing in my...
2
by: Ronald | last post by:
I hope somebody can help. I can't get into the specifics of my project, but I'll try to create a simple example: tblVehicle * VIN (text box) * Make (text box) * Model (text box) frmRepair
2
by: paulyXvpf | last post by:
Hi All, FACTS: > I've created a VB.NET 2005 form, with a SQL Server 2000 backend > The form has about 30 fields that populate 30 columns in the SQL database > The form has mostly text feilds,...
4
by: olidenia | last post by:
I need some help or tips on the following. I have a .sql database file with the folowing structure: DROP TABLE IF EXISTS `car`; CREATE TABLE IF NOT EXISTS `car` ( `id` int(10) default...
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?

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.