473,385 Members | 1,570 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 Values

I have 4 possible values that I would like to populate a text box with
depending on which 4 values are sleected in a select box. Is there an
example out there for this?

Thanks
Frank

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
4 10997
<script language="javascript">
function changetext(Dropdown_Val, Dropdown_Val_SI)
{
switch (Dropdown_Val[Dropdown_Val_SI].value)
{
case 'Cheese' :
document.MyForm.TextField.value="Cheese";
break
case 'Ham' :
document.MyForm.TextField.value="Ham";
break
default :
document.MyForm.TextField.value="No Value";
break
}
}
</script>

<form name="MyForm">
<select name="DropField" onChange="changetext(this,this.selectedIndex);">
<option value="Choose">Choose</option>
<option value="Ham">Ham</option>
<option value="Cheese">Cheese</option>
</select>
<input type="text" name="TextField">
</form>

Stu

"Frank Py" <fp*@proactnet.com> wrote in message
news:3e*********************@news.frii.net...
I have 4 possible values that I would like to populate a text box with
depending on which 4 values are sleected in a select box. Is there an
example out there for this?

Thanks
Frank

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 20 '05 #2
"Stuart Palmer" <tr**********@youcant.com> wrote in message news:<hN****************@newsfep2-gui.server.ntli.net>...
<script language="javascript">
function changetext(Dropdown_Val, Dropdown_Val_SI)
{
switch (Dropdown_Val[Dropdown_Val_SI].value)
{
case 'Cheese' :
document.MyForm.TextField.value="Cheese";
break
case 'Ham' :
document.MyForm.TextField.value="Ham";
break
default :
document.MyForm.TextField.value="No Value";
break
}
}
</script>

<form name="MyForm">
<select name="DropField" onChange="changetext(this,this.selectedIndex);">
<option value="Choose">Choose</option>
<option value="Ham">Ham</option>
<option value="Cheese">Cheese</option>
</select>
<input type="text" name="TextField">
</form>

Stu

"Frank Py" <fp*@proactnet.com> wrote in message
news:3e*********************@news.frii.net...
I have 4 possible values that I would like to populate a text box with
depending on which 4 values are sleected in a select box. Is there an
example out there for this?

Thanks
Frank

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


<form name="MyForm">
<select name="DropField" onChange="document.MyForm.TextField.value =
this.options[this.selectedIndex].value;">
<option value="">Choose</option>
<option value="Ham">Ham</option>
<option value="Cheese">Cheese</option>
</select>
<input type="text" name="TextField">
</form>
Jul 20 '05 #3
JHLeong wrote on 30 jun 2003 in comp.lang.javascript:
<form name="MyForm">
<select name="DropField" onChange="document.MyForm.TextField.value =
this.options[this.selectedIndex].value;">
<option value="">Choose</option>
<option value="Ham">Ham</option>
<option value="Cheese">Cheese</option>
</select>
<input type="text" name="TextField">
</form>


Nice and short, I changed it to:

<select
onChange="location.href =
this.options[this.selectedIndex].value;">
<option value="">Go to</option>
<option value="http://cnn.com/">CNN</option>
<option value="http://google.com/">Google</option>
</select>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #4
Frank Py wrote on 30 jun 2003 in comp.lang.javascript:
Thanks for the great examples. I just have one more question on this.
I'm using some sample code that uses ASP and the Response.Write to write
out all the html as it is called with functions. So when it hits the
first double quote in these examples, it thinks it the end of a state
ment:

Response.Write "<tr><td>Date</td>"


Use single quotes in javascript.

====================================

or change

Response.Write "<option value='http://google.com/'>Google</option>"

to

%><option value="http://google.com/">Google</option><%

because why use Response.Write in stead of straight html here ????

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #5

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

Similar topics

1
by: David Shorthouse | last post by:
HI is it posible to auto populate an access database.? I have 1 table structured Index_ID. - Index & auto number First_Name - Char50 Surname - Char50 Initals - Char50 Postcode - Char50...
2
by: C. David Rossen | last post by:
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...
5
by: joshua.nicholes | last post by:
I have an access database that consists of two tables.A data collection table and a species list table. The data collection table has about 1500 records in it and the species list has about 600....
1
by: gauravtechie | last post by:
Hi all, I have a javascript that is reloading itself on every menu change, Now the problem is that the values of the product doesn`t reset itself on catalogue change, the code is <html>...
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...
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
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: disney86 | last post by:
I am setting up Forms in Access 08. I have a form which when opened will auto insert the current time and current date. I need to be able to allow the user to set up paramaters to auto select a...
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: 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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.