473,789 Members | 2,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please help: How to populate a text box after a drop down list is selected?

1 New Member
I've worked with ASP.NET but don't know much about ASP at all. I have the following code. I would like to get a person' birthday and phone number text box populated when the person's name is selected from a drop down list box.


Patient's Name: <select name="patientNa me" onChange="javas cript:ShowPatie nInfo();">
<%
dim tempBirthday, tempPhone
Set DBConn = Server.CreateOb ject("ADODB.Con nection")
DBConn.Open "DSN=Dispensary DSN"
sql = "usp_GetPatient Info"
set pnRs = DBConn.Execute( sql)
while not pnRs.EOF
response.Write( "<option value=" & pnRs("CustomerI D") & ">" & pnRs("Patient") & "</option>")
tempBirthday = pnRs("Birthdate ")
tempPhone = pnRs("HomePhone Number")
%>

<script type="text/javascript" language="javas cript">
function ShowPatientInfo ()
{
document.testFo rm.action="test .asp?Action=Dis playPatientInfo ";
document.testFo rm.submit();
}
</script>

<%
if Request.QuerySt ring("Action") = "DisplayPatient Info" then
'document.getEl ementById('birt hday') = "<%=tempBirthda y%>
'document.getEl ementById('phon e') = "<%=tempPho ne%>
response.write ("test")
End If
%>

<%
pnRs.MoveNext
wend
pnRs.close
set pnRs=nothing
%>
</select>

Date of Birth: <input type="text" name="birthDay" value=""/>
Phone: <input type="text" name="Phone" value="">


Even if I commented out these two lines ('document.getE lementById('bir thday') = "<%=tempBirthda y%>
'document.getEl ementById('phon e') = "<%=tempPhone%> ) and just wanted to print out a word "test" on the screen after the drop down list was selected, nothing happened. What's wrong with my code? Or is there a better way to do it? Can anyone help? Thanks a lot in advance!

Jennifer
Jun 23 '07 #1
0 1572

Sign in to post your reply or Sign up for a free account.

Similar topics

6
15421
by: Greg Scharlemann | last post by:
I am attempting to populate a drop down menu based on the selection of a different drop down menu. However, it is not working correctly, I cannot figure out for the life of me what exactly happens because I am not getting any errors on the page. <html> <script language="javascript"> var phaseArray = new phaseArray(4); var phaseTypeId = new phaseTypeId(4); var phaseId = new phaseId(4);
1
6366
by: Greg Scharlemann | last post by:
I would like to automatically populate a drop down menu when the page loads based on the selection of an item in a different drop down menu. I made a test page that when drop down #1 changes, drop down #2 populates. Does anyone know how to get drop down #2 to populate based on what is selected in drop down #1 when the page loads? Here is my test code: ************************************************************************ <html>...
14
3112
by: alwayshouston | last post by:
Hi All! I am working on this very small database and I am confused in the designing a simple form. I only have three tables in the database. First Table: tblExpense Columns: ExpenseID ; ExpenseType Data: 1 ; FOOD 2 ; AIRLINE 3 ; FARE
7
2172
by: Stephen | last post by:
I have some code which I call from a custom validator however I seem to have got the logic wrong and im having trouble figuring out how to write my code to get things to work the way I require. Below is the script I currently use and what it does along with what I would like it to do. Can someone please help me work how I can fix this. <script> function ValidateDropDownOrCheckBox(sender, args) { if ( document.forms.DropDownList1.value...
3
1531
by: Mike | last post by:
I have a web page that displays contact people in a drop down. the users selects a person then clicks the go button. The datagrid should pop with all the information on the select contact person, correct? Well, now my issue. I have 5 contact names in the drop down, (pop from DB) when I select one nothing happens except for one name. I only get information back for only one person, nothing happens if i select a different name. The grid...
3
6899
by: Yi Chen | last post by:
We have a drop down list on a PHP page, with several product names, and when people click one item, we will refresh the same page with the product name as parameter, and in turn we want to include a HTML file into the content area of the same page. I know it is recommended to put everything into database, but we want the web site to be very "portable", so the drop-downlist and the content should both in text files. Let's say the...
2
1628
by: cpptutor2000 | last post by:
Could some PHP guru please help me? I am creating a dynamic dropdown list using a code snippet(Section A) as below: Section A: $sql_query=mysql_query("SELECT DISTINCT semester, year from schoolproject_pics ORDER BY year DESC"); echo "<select name=\"semester\" onchange=\"GoTo()\">"; echo "<option value=\"$semester\">-Semester Year-</option>"; while($data = mysql_fetch_array($sql_query)){ if($data==@$semester && $data==@$year){
5
17686
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. The species list has 7 fields the first is a four digit unique identifier (species) it is set as the primary key. I have created a relationship to the data collection table which also has a species field (4 digit id). In my form I have the species...
12
2347
by: iahamed | last post by:
Hi Everyone, I got two parts of my advance search to work, I am running out of Logic to connect the third. My mind is in swing! Pleaseeeeeeeee Help me. I have 3 Fiels to search, the First two works, thats: 1. Category to search from the (Drop down name: ASPDBCatSearch) is working with the Input Text Box Field (name: keyword), based on Whatever selection on the Drop down value selection:
0
9666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10412
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9986
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5422
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3703
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.