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"))
Main Topics
Browse All TopicsHi,
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.
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.
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.
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.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
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.
<%
Dim objConn 'declare your variable to hold your connection
Dim connectionString ' path to our Access database (*.mdb) file
Set objConn=Server.CreateObjec
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(getProject
Response.Write "<select name='projCode' onchange='document.all.tem
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
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.
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
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=updateme
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:retur
function saveFinalValidate(msg){
if (validateInput()==true && validateDataType()==true ){
document.f.action="UpdateM
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.
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"
<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(getProject
Response.Write "<select name='projCode' onchange='document.all.tem
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
</form>
</body>
</html>
wishing success,
kavitha
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.
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.CreateObjec
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(getProject
Response.Write "<select name='projCode' onchange='document.all.tem
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'
<p>Project Code: <input type=text value="<%=Request.Form("pr
<!--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.
</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
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.
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
Business Accounts
Answer for Membership
by: Silvers5Posted on 2003-08-12 at 00:43:43ID: 9128248
http://www.programmersreso urce.com/a rticles/li stbox.asp