Login | |
|
 |
RE: Setting the value of a <select> - 4/24/2008 1:11:52 AM
|
|
 |
|
| |
killieblues
Posts: 5
Score: 0
Joined: 4/3/2008
Status: offline
|
Here's the relevant area of the asp file <!-- get the event information from the database if applicable --> <% eventID = request.form("eventid") dim egenrex, ename, eband, ename, eband, edate, etime, elocation, eprice, etickets, eimage, epromotion, ediscount egenrex = "" ename = "" eband = "" edate = "" etime = "" elocation = "" eprice = "" etickets = "" eimage = "" epromotion = "" ediscount = "" ' only query the database if not a new event being created if eventID <> "new" then 'Create an ADO connection odject Set adoConnection = Server.CreateObject("ADODB.Connection") 'Set an active connection to the Connection object using a DSN-less connection adoConnection.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("NewDawn.mdb") 'Create an ADO recordset object Set rsRecordSet = Server.CreateObject("ADODB.Recordset") 'Initialise the strSQL variable with an SQL statement to query the database strSQL = "SELECT * FROM tblEvent WHERE EventID = " & eventID & ";" 'Open the recordset with the SQL query rsRecordSet.Open strSQL, adoConnection 'Loop through the recordset Do While not rsRecordSet.EOF egenrex = rsRecordSet("Type") ename = rsRecordSet("Name") eband = rsRecordSet("ArtistName") edate = rsRecordSet("Date") etime = rsRecordSet("StartTime") elocation = rsRecordSet("Venue") eprice = rsRecordSet("TicketPrice") etickets = rsRecordSet("maxTickets") eimage = rsRecordSet("ImagePath") epromotion = rsRecordSet("Promotion") ediscount = rsRecordSet("Discount") 'Move to the next record in the recordset rsRecordSet.MoveNext Loop 'Reset server objects rsRecordSet.Close adoConnection.Close Set rsRecordSet = Nothing Set adoConnection = Nothing end if %> <td bgcolor = "#ddddff" colspan = "6" valign = "top" width = "690"> <div id = "content"> <table> <form name = "eventupdate" method = "post" action = "updevent.asp"> <!-- set the pageid value to eventupdate as that is where we want to redirect to --> <input type = "hidden" name = "pageid" value = "eventupdate.asp"/> <tr> <td> <p>Genre</p> </td> <td> <select name = "egenre"> <% 'Create an ADO connection odject Set adoConnection = Server.CreateObject("ADODB.Connection") 'Set an active connection to the Connection object using a DSN-less connection adoConnection.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("NewDawn.mdb") 'Create an ADO recordset object Set rsRecordSet = Server.CreateObject("ADODB.Recordset") 'Initialise the strSQL variable with an SQL statement to query the database strSQL = "SELECT * FROM tblGenre;" 'Open the recordset with the SQL query rsRecordSet.Open strSQL, adoConnection 'Loop through the recordset Do While not rsRecordSet.EOF 'Write the HTML to display the current record in the recordset response.write ("<option value = """ & rsRecordSet("GenreID") & """>" & rsRecordset("Description") & "</option>") 'Move to the next record in the recordset rsRecordSet.MoveNext Loop 'Reset server objects rsRecordSet.Close Set rsRecordSet = Nothing Set adoConnection = Nothing %> </select> <% eventupdate.egenre.value = egenrex %> </td> </tr>
|
|
| |
|
|
|
 |
RE: Setting the value of a <select> - 4/24/2008 1:20:11 AM
|
|
 |
|
| |
ebgreen
Posts: 4408
Score: 29
Joined: 7/12/2005
Status: offline
|
Ehh...too much ASP for me. You're going to need one of the web dev types (which I am not) to look at it. As a matter of fact I'm going to move this to the ASP forum.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Setting the value of a <select> - 4/24/2008 5:48:20 AM
|
|
 |
|
| |
TNO
Posts: 974
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
The page loads and the <select> element has a list of data already prefilled when I go to the page correct? and you want to update this information? Does the user ask to update this? At what point does is this information supposed to change?
_____________________________
Consolidated Script Component: Now in Testing stage! A universe of complexity...
|
|
| |
|
|
|
 |
RE: Setting the value of a <select> - 4/27/2008 8:14:34 AM
|
|
 |
|
| |
TNO
Posts: 974
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
selectedIndex is a setter and a getter. you could do something like this: <body onload="document.getElementById('mySelect').selectedIndex = 2">
_____________________________
Consolidated Script Component: Now in Testing stage! A universe of complexity...
|
|
| |
|
|
|
|
|