473,770 Members | 3,398 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I want to fill budget code field when the department is selected in the combo box

4 New Member
I have table departments with three fields DeptID, DepartmentName and budgetcode. Departments value are populated in the dropdown menu. i need to fill the text box of budgetcode when department is selected.

here is code for departmentlist is populated

Expand|Select|Wrap|Line Numbers
  1. <select name="Department" id="Department" onChange="showText();">
  2.                 <option value="notselected" selected>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
  3.                 <%
  4.     set rs1=server.createobject("adodb.recordset")
  5.     DepartmentSQL="Select DeptID,DepartmentName,bcode from departments order by Departmentname"
  6.  
  7.     rs1.open DepartmentSQL,cn,3
  8.  
  9.     while not rs1.eof
  10.                  DepartmentID=rs1("DeptID")
  11.                  DepartmentName=rs1("DepartmentName")
  12.                  bcode=rs1("bcode")
  13.             %>
  14.                 <option value="<%=DepartmentName%>"><%=DepartmentName%></option>
  15.                 <%rs1.movenext
  16.       wend
  17.  
  18.      %>
  19.               </select>
Jun 24 '13 #1
6 1349
Dormilich
8,658 Recognized Expert Moderator Expert
that us usually done through AJAX. you fetch the data by using the selected value and insert the returned data in your output container.
Jun 24 '13 #2
moiz20
4 New Member
Can you please write it here to help me out
Jun 24 '13 #3
Dormilich
8,658 Recognized Expert Moderator Expert
I can help improve your code.
Jun 24 '13 #4
moiz20
4 New Member
Please it would be great!
Jun 24 '13 #5
Dormilich
8,658 Recognized Expert Moderator Expert
show us what you tried.
Jun 24 '13 #6
moiz20
4 New Member
The function i am using to fill the value but it is not working.
Expand|Select|Wrap|Line Numbers
  1. function showText()
  2.       {
  3.  
  4.         //This functions is used show selected value of listbox into textbox.
  5.          var objselect;
  6.          var txtval;
  7.         objselect=document.forms['form1'].Departments;
  8.  
  9.        //Get the selected value from listbox
  10.         txtval=objselect.options[objselect.selectedIndex].value;
  11.  
  12.        //Display it in textbox 
  13.         document.getElementById('Budget_Code').value = txtval; 
  14.       }
The database is in access
Departments table there are three field. DeptID, DepartmentName and bcode.
Here is the code for department list
Expand|Select|Wrap|Line Numbers
  1. <select name="Department" id="Department" onChange="showText();">
  2.                 <option value="notselected" selected>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
  3.                 <%
  4.     set rs1=server.createobject("adodb.recordset")
  5.     DepartmentSQL="Select DeptID,DepartmentName,bcode from departments order by Departmentname"
  6.  
  7.     rs1.open DepartmentSQL,cn,3
  8.  
  9.     while not rs1.eof
  10.                  DepartmentID=rs1("DeptID")
  11.                  DepartmentName=rs1("DepartmentName")
  12.                  bcode=rs1("bcode")
  13.             %>
  14.                 <option value="<%=DepartmentName%>"><%=DepartmentName%></option>
  15.                 <%rs1.movenext
  16.       wend
  17.  
  18.      %>
  19.               </select>
Jun 24 '13 #7

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

Similar topics

7
2240
by: jballard | last post by:
Hello, I have a database set-up with a form and two subforms in it. I have one of the subforms (replacement parts) set-up where you can pick part numbers from a drop down box and also pick a description of the part from a drop down box. These are two separate fields. I want to be able to pick the part number and have it put in the description automatically or the other way around. Which ever would by easier?
3
1837
by: euphorica | last post by:
I am making an inventory database. I have a field InventoryNumber where I put a specific code. The code always starts with a particular letter. I would like to fill in another field with specific information based on what that letter is. Can somebody show me how to do this? Thanks in advance.
3
8320
by: Steve Yerkes | last post by:
There seems to be way too much confusion over how to set focus on the a field using a field validator. I looked all over the web and found people trying to do this, but not getting anywhere. There are a couple of people selling components... but that is not really an option for me... So, I took the plunge and modified the "WebUIValidation.js" file to make it happen... After tracing through file, I figure it out. It was actually pretty...
6
4881
by: MROPARTNER | last post by:
I have a field in a form called "Date" I am looking to fill this text field with the current date. Is there a way to do this with ASP or an easier way? Thanks Bill
4
3037
by: rsine | last post by:
The company I work for owns several domain names for which email aliases have been created. For example, a user may have a primary address of bob@xyz.com and an alias of bob@wxy.com. Our customers can send to either the user's primary address or any of his or her aliases. My question is, is there a plugin or can a plugin be created for Outlook to fill in the FROM field when responding to an email based upon how the email was received? ...
2
7992
by: bkunjitam | last post by:
Hi, I am using Python 2.5. I have an entry field and a radio button. I need to disable the entry field when the radio button is selected. How do i change the state to DISABLED in run time. Kindly help me out.
1
1670
by: imwhiteandnerdy | last post by:
i'm hoping I can get some help with adding my combo box selection to my access database.Any Help would be appreciated. I've been told I need complex binding Basically I just want to add the selection to the database field DATABASE =cc TABLE =customer FIELD IN DATABASE= custCity COMBO BOX =cboCity My combo box name is cboCity Has the following collection of items linked
2
3410
by: mckurban | last post by:
Hi All, I'm not very familiar with Javascript and need help with setting up some javascript code to allow users to create dynamic radio buttons from text field and then to use selected radio value (text string) to appear as firs in the entered field. I've maneged to get to the dynamic creation part: <script type="text/javascript"> function update_radio_buttons() { var companyName =...
1
2353
by: bytenut | last post by:
I would like to display two field values in a combo after selecting from the list items... i.e. my drop-down shows two fields from a lookup, but when I select the item, only the first field value is shown in the combo text area (at the top)... (bound field is invisible) e.g. Currently seeing (standard behavior) drop-down | 1 drop-down | 2 drop-down | 3
3
3549
by: Ron Mowry | last post by:
I am wanting to create a macro that will fill a specific field on a form and then go to the next record set. I have a blank field in the table that the form is pulling from. I want the user to be able to click a button I have inserted into the form which will go to the next record but I also want that button to fill in that blank field on the form with the users initials before moving to the next record. I do not want the user to type anything...
0
9591
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
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10057
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...
1
10002
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8883
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5312
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
3970
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
3
2816
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.