Question

Combobox onchange event should retrieve and display information related to the selected project code in a textbox below the combobox on the page itself. Could anyone help me?

Asked by: aneethat

Hi,

          I have a combo box shows the Project code. I have to display other information in a text box according the Project code selected.

I.e. Onchange event of combo box should fill up the other value in the text box given below on the same page.

Let me explain.

I have a calendar with a link on the date. When the user clicks on the date it will goes to meeting.asp page where I have the combo box and other textbox. This page will show records that have meeting schedule on a day the user clicked
The combo box will show the project code that has meeting on the selected date. Under the combo box there is 4 textbox to display date of meeting, venue, time of meeting, agenda according the project code selected in the combo box I.e. on the meeting.asp page itself.

When the user clicks on a particular date it should display first project code (descending order) as a selected value in a combo box and other related information in the textbox below.

Could any one help me?

Aneethat.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2003-08-12 at 00:19:26ID20706850
Tags

combobox

,

onchange

Topic

Active Server Pages (ASP)

Participating Experts
3
Points
40
Comments
13

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. onChange not working
    I have a text field that takes date, and I have a javascript calendar that user can use to pick the date. I get my calendar source code in http://javascript.internet.com/calendars/popup-date-picker.html Whenever I enter the date, I want to change the other select option to...
  2. Onchange
    Hi Experts, I have 2 related problems. First some background... I have a form and when a field called 'DateCompleted' is updated, a checkbox is automatically checked using the following onchange code <script language="JavaScript"> function chkCPCheck(ctr...
  3. onchange on combobox
    Hi, I would like to ask about the onchange method in javascript. For example: if there is name combobox in my jsp page, the names inside it are retrieved from database. if I want like if I select 'lala' from combobox then it will display a table of information about 'lala' ...
  4. onchange question
    i have 1 icon and 1 input box. Value in the input box is a date, when onchange the input box, i perform date validation. if the date is wrong format, it will return false. the problem is when return false, i cannot click the icon, actually the icon is call a pop out calenda...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: Silvers5Posted on 2003-08-12 at 00:43:43ID: 9128248

 

by: ryancysPosted on 2003-08-12 at 00:56:09ID: 9128294

At the onchange event of combobox, try submitting the form. The try get to see whether a request valie of the combo box is passed or not (like if isEmpty(Request("combo1"))=false then 'do your SQL querying..) to determine whether to populate value into the textboxes or not.

 

by: ckavithaPosted on 2003-08-12 at 22:03:44ID: 9136141

<%
Dim objConn 'declare your variable to hold your connection
Dim connectionString  ' path to our Access database (*.mdb) file
Set objConn=Server.CreateObject("ADODB.Connection")
connectionString="DBQ=" & Server.MapPath("test.mdb")
objConn.open "DRIVER={Microsoft Access Driver (*.mdb)}; " & connectionString
%>
<html>
<body>
<form action="meeting.asp" method="post" name="frmMeet">
<input type=hidden name="temp" value=0>
<p>Project Code:
<%
      'Gets the Project Code From Databse
      getProjectCode = "SELECT * FROM test ORDER BY ProjectCode DESC"
      Set RS = objConn.Execute(getProjectCode)
      Response.Write "<select name='projCode' onchange='document.all.temp.value=1;document.frmMeet.submit();'>"
      Do While Not RS.EOF
            opts = ""
            If Request.Form("projCode") = RS("ProjectCode") Then
                  opts = "selected "
            End If
            Response.write "<option " & opts & "value='" & RS("ProjectCode") & "'>" & RS("ProjectCode") & "</option>"
            RS.MoveNext
      Loop
      Response.Write "</select></p>"
      If Request.Form("temp") = 1 Then
            getTextBox = "SELECT * FROM test WHERE ProjectCode = '" & Request.Form("projCode") & "'ORDER BY ProjectCode DESC"
            Set RS = objConn.Execute(getTextBox)      
            text1 = RS("Textbox1")
            text2 = RS("Textbox2")
            text3 = RS("Textbox3")
      End If
%>
<p>TextBox 1: <input type=text value="<%=text1%>"></p>
<p>TextBox 2: <input type=text value="<%=text2%>"></p>
<p>TextBox 3: <input type=text value="<%=text3%>"></p>
</form>
</body>
</html>

Wishing Success,
kavitha

 

by: aneethatPosted on 2003-08-14 at 01:52:41ID: 9144940

Hi ckavitha,

                 Thank you for your reply. I would like to update the date from the page meeting.asp page. So it would be better if you give a code to call a javascript function and from the javascript function using document.f.action i can use different file for updating as well as the event change.

So could you please tell how do i call a javascript function from the onchange event of combobox and the javascript function.

i would be very greatful if you could.

Thanks a lot.

Anitha.

 

by: ckavithaPosted on 2003-08-14 at 02:13:02ID: 9145025

Hi Anitha,

I am not clear with your requirement. could you please explain me what the javascript function should do? What different file you want to add? What does that file contain?

my understanding is that you will have the project code and corresponding dates in Database and onchange of the project code the textbox values should change.

you can call the javascript funtion like <select name="projcode" onChange="disDates()">. the disDates() will be your javascript function.

please provide me the exact requirement, i will provide you the code.

Wishing Success,
kavitha

 

by: aneethatPosted on 2003-08-14 at 18:18:59ID: 9151332

Hi Kavitha,

              Thank you for your reply. I let you know my requirements. The meetin.asp page will contains the above as i explained in the question.

This meeting.asp page has a option to the admin member to reschedule the meeting for the whole projects if the meeting is canceled on a particular day.

So i need to call the updatemeeting.asp if the user wants to change something. if i use the above code that you have given in the onchange event i call the meeting.asp page itself to display the information according to the Project Code selected.

so for this onchange event to work i give the form tag like this

<form name=f method=post action=meeting.asp>


But before i used the form tag like this <form name=f method=post> and the submit button call the javascript function where i have given the document.f.action=updatemeeting.asp.

so the submit button (i.e changes to be done) call a javascript function and submits the form to updatemeeting.asp.

Response.write "<input name=Confirm type=submit value='Submit' onclick=""javascript:return saveFinalValidate('Click on OK to save your changes.');"">"

function saveFinalValidate(msg){      
 
 
      if (validateInput()==true && validateDataType()==true ){
               document.f.action="UpdateMeeting.asp"            
            document.f.submit();
            return true;
                      }
            return false;
      
              }

If i use the onchange event and submit the form by giving the form tag with action to the same form(meeting.asp). When i clicks the submit button it again calls the meeting.asp instead of updatemeeting.asp

i called the javascript function as you given onChange="disDates()" like this i call onchange="display()" but it does not work.

could you please let me the reason why.

Thank you for your help.

 

by: ckavithaPosted on 2003-08-15 at 20:34:11ID: 9164264

Hi Anitha,

you can have the form tag action variable as updatemeeting.asp. in onchange event temp value will be 1. you can set the temp value as 2 on click of submit button and when the temp value is 2 you can update the details.

for example:

<form action="updatemeeting.asp" method="post" name="frmMeet">
<input type=hidden name="temp" value=0>
<%
    'Gets the Project Code From Databse
    getProjectCode = "SELECT * FROM test ORDER BY ProjectCode DESC"
    Set RS = objConn.Execute(getProjectCode)
    Response.Write "<select name='projCode' onchange='document.all.temp.value=1;document.frmMeet.submit();'>"
    Do While Not RS.EOF
         opts = ""
         If Request.Form("projCode") = RS("ProjectCode") Then
              opts = "selected "
         End If
         Response.write "<option " & opts & "value='" & RS("ProjectCode") & "'>" & RS("ProjectCode") & "</option>"
         RS.MoveNext
    Loop
    Response.Write "</select></p>"
    If Request.Form("temp") = 1 Then
         getTextBox = "SELECT * FROM test WHERE ProjectCode = '" & Request.Form("projCode") & "'ORDER BY ProjectCode DESC"
         Set RS = objConn.Execute(getTextBox)    
          text1 = RS("Textbox1")
         text2 = RS("Textbox2")
         text3 = RS("Textbox3")
    End If
    If Request.Form("temp") = 2 Then
          'Update the database here............
    End If
%>
<p>TextBox 1: <input type=text value="<%=text1%>"></p>
<p>TextBox 2: <input type=text value="<%=text2%>"></p>
<p>TextBox 3: <input type=text value="<%=text3%>"></p>
<input type=submit value=UPDATE onclick="document.all.temp.value=2">
</form>
</body>
</html>

wishing success,
kavitha

 

by: aneethatPosted on 2003-08-18 at 19:27:10ID: 9178154

Hi Kavitha,

                    Thank you for your help. I would like to clarify something, as you told for update, I incremented the temp value but i am quite confusing is it possible to update on the meeting.asp page itself for the changes.

For example under this line

If Request.Form("temp") = 2 Then
         'Update the database here............

        ' can i give like this the oRs recordset will retrieve the selected projectcode record and update the following

         oRs("DOM") = Request.form("date")
         oRs("ProjectCode") = Request.form("ProjectCode")
         oRs.Update


       'or do i need to redirect to updatemeeting.asp file.
        if so for all the Projectcode on a particular date should be changed is it possible to update the information for more than one record at a time.
   End If


could you please help me solve? Thanks for your time to help me.

anitha.

 

by: ckavithaPosted on 2003-08-18 at 21:00:25ID: 9178448

Let me confirm my understanding with you.

1. you have form called meeting.asp, where the user will update the changes in the meeting schedule.

2. you have a form called updatemeeting.asp, which will update the updated dates into the database.

3. in the meeting.asp you have a combobox and four textbox. on change of the combobox you need to change the display.

please find below the coding:

you can have two form tags, one for the select option and the rest for the four text box and update button.

Code for meeting.asp:
----------------------------
<%
Dim objConn 'declare your variable to hold your connection
Dim connectionString  ' path to our Access database (*.mdb) file
Set objConn=Server.CreateObject("ADODB.Connection")
connectionString="DBQ=" & Server.MapPath("test.mdb")
objConn.open "DRIVER={Microsoft Access Driver (*.mdb)}; " & connectionString
%>
<html>
<body>
<form action='meeting.asp' method='post' name='frmComboboxMeet'>
<input type=hidden name="temp" value=0>
<p>Project Code:
<%
      'Gets the Project Code From Databse
      getProjectCode = "SELECT * FROM test ORDER BY ProjectCode DESC"
      Set RS = objConn.Execute(getProjectCode)
      Response.Write "<select name='projCode' onchange='document.all.temp.value=1;document.frmComboboxMeet.submit();'>"
      Do While Not RS.EOF
            opts = ""
            If Request.Form("projCode") = RS("ProjectCode") Then
                  opts = "selected "
            End If
            Response.write "<option " & opts & "value='" & RS("ProjectCode") & "'>" & RS("ProjectCode")
                                                            & "</option>"
            RS.MoveNext
      Loop
      Response.Write "</select></p>"
      If Request.Form("temp") = 1 Then
            getTextBox = "SELECT * FROM test WHERE ProjectCode = '" & Request.Form("projCode") & "'ORDER BY ProjectCode DESC"
            Set RS = objConn.Execute(getTextBox)      
            text1 = RS("Textbox1")
            text2 = RS("Textbox2")
            text3 = RS("Textbox3")
      End If
%>
</form>
<form action='updatemeeting.asp' method='post' name='frmMeet'>
<p>Project Code: <input type=text value="<%=Request.Form("projCode")%>" name=pcode>
<!--YOu can hide this text box if you need.-->
</p>
<p>TextBox 1: <input type=text value="<%=text1%>" name=text1></p>
<p>TextBox 2: <input type=text value="<%=text2%>" name=text2></p>
<p>TextBox 3: <input type=text value="<%=text3%>" name=text3></p>

<input type="submit" value="UPDATE" onClick="document.frmMeet.submit();">
</form>
</body>
</html>

Code for updatemeeting.asp:
-------------------------------------

<%
'you can do the updation to the database here
Response.Write Request.Form("text1") & "<br>"
Response.Write Request.Form("pcode")
%>

Wishing success,
kavitha

 

by: aneethatPosted on 2003-08-18 at 23:14:37ID: 9178832

Hi Kavitha,

                  Thank you for your help. Your understanding is correct. Yes, The meeting.asp will display all the projectcode on a particular date. The combobox will show all the PCode. The textbox below will give the information according to the PCode selected.

The User will change in the text box i.e the first four lines of textbox i.e in the form name called frmComboboxMeet.

Let say if the user select PCODE1 and the textbox will display the relevant information. Let say the user changes the Date of meeting and time of meeting.

For this condition i can't use frmmeet form. Because the textboxes are in frmComboboxMeet form. So if i put submit button inside this form. it will again submits to meeting.asp (as per onchange event and form action).

Then how do i update the value? are you clear what am i trying to explain?

Thanks for the time to answer me.  if you could let me the solution.

Thank you.

anitha.

 

by: ckavithaPosted on 2003-08-19 at 01:57:47ID: 9179476

Hi Anita,

if you could see my coding, the textboxes are in frmMeet form (and not in frmComboboxMeet form), which will get redirected to updatemeeting.asp.

onchange will submit meeting.asp, and
onclick will submit updatemeeting.asp, where onclick of UPDATE button the values will be updated to the database.

'frmComboboxMeet' - for Combobox
'frmMeet' -  for textbox and UPDATE button.

With updatemeeting.asp you can request the textbox's text. The Code has been written with the understanding that when the user changes the textbox, he will click the update button to update the values into the database.

bye,
kavitha

 

by: aneethatPosted on 2003-08-19 at 17:53:56ID: 9184926

Hi Kavitha,

                    Thank you for your reply. I think i disturb you much. Thank you for your help for ever.


anitha.

 

by: ckavithaPosted on 2003-08-19 at 20:12:47ID: 9185445

Hi Anitha,

It is really nice to hear that your problem has been resolved. It has been my pleasure helping you.

bye,
kavitha

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...