Ok, I'm very new to asp, but this is what I'm trying to accomplish. I want to have a selection drop down list where the user can select a database to load. When they select the database, I want that value to then populate the asp variable named "database". I was hoping I could pass this using javascript, but I don't think I can because asp is server side and javascript is client side.
Any help would be appreciated! -
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-
<html>
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-
<title>OpenLink Monitor</title>
-
<link rel="stylesheet" type="text/css" href="./css/style.css" />
-
-
<script>
-
<!--
-
-
/*
-
Auto Refresh Page with Time script
-
By JavaScript Kit (javascriptkit.com)
-
Over 200+ free scripts here!
-
*/
-
-
//enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59
-
var limit="0:90"
-
-
if (document.images){
-
var parselimit=limit.split(":")
-
parselimit=parselimit[0]*60+parselimit[1]*1
-
}
-
function beginrefresh(){
-
if (!document.images)
-
return
-
if (parselimit==1)
-
window.location.reload()
-
else{
-
parselimit-=1
-
curmin=Math.floor(parselimit/60)
-
cursec=parselimit%60
-
if (curmin!=0)
-
curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
-
else
-
curtime=cursec+" seconds left until page refresh!"
-
window.status=curtime
-
setTimeout("beginrefresh()",1000)
-
}
-
}
-
-
window.onload=beginrefresh
-
-
function changeDb(db_sel){
-
alert(db_sel.value)
-
}
-
//-->
-
</script>
-
-
<!---adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=
-
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("oplmodel.mdb")
-
strSQL = "SELECT Interface.Name, Interface.Full_name FROM INTERFACE;"
-
response.write(Server.MapPath("opl_monitor.asp"))
-
--->
-
-
<style type="text/css">
-
<!--
-
.style2 {font-size: small}
-
-->
-
</style>
-
</head>
-
<body>
-
<%
-
Dim adoCon
-
Dim OpenLink
-
Dim strSQL
-
Dim database
-
-
Set adoCon = Server.CreateObject("ADODB.Connection")
-
-
database="\\grpb\grpb\23040003\Data\OPLT23040003B_TEST2_SFC1.mdb"
-
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & database
-
-
Set OpenLink = Server.CreateObject("ADODB.Recordset")
-
strSQL = "Select ASSOCIATION.ASSOC_NAME,Interface.Full_Name from ASSOCIATION inner join interface on association.assoc_name=interface.name where ASSOCIATION.NAME='OPLENG'"
-
getIPInfo = "Select API_LISTEN,ALERT_LISTEN from ENGINE"
-
-
-
-
set opls = CreateObject("SMSOPENLINK.SMSOPENLinkSession.1")
-
set oplc = CreateObject("SMSOPENLINK.SMSOPENLinkControl.1")
-
-
OpenLink.Open getIPInfo, adoCon
-
-
opls.ServerPort = OpenLink("API_LISTEN")
-
opls.AlertPort=OpenLink("ALERT_LISTEN")
-
opls.MachineName = "GRPB"
-
opls.OpenPath 3, "OPL_USER"
-
retstatus = server.HTMLEncode(opls.LastStatus)
-
OpenLink.Close
-
-
OpenLink.Open strSQL, adoCon
-
%>
-
-
<h3>OpenLink Monitor v0.1</h3>
-
-
<h5>Open Path Return Status: <%=Server.HTMLEncode(retstatus)%></h5>
-
<center>
-
<span class="style2">Please select the design to monitor:</span>
-
<select name="sel_db" OnChange="changeDb(this);return false;">
-
<option value="\\grpb\grpb\23040003\Data\OPLT2340_Instruments_B.MDB">TEST - Instruments</option>
-
<option value="\\grpb\grpb\23040003\Data\OPLT23040003B_TEST2_SFC1.mdb">TEST - FTP</option>
-
<option value="\\grpb\grpb\23040003\Data\oplt2340_FTP_B.mdb">TEST - Main</option>
-
</select>
-
</center>
-
<br />
-
<table cellspacing=0 align="center">
-
<tr>
-
<th>Interface</th>
-
<th>Description</th>
-
<th>Status</th>
-
</tr>
-
-
<%
-
Do While not OpenLink.EOF
-
-
status_text = oplc.StatusInterface(opls,OpenLink("ASSOC_NAME"))
-
Response.Write("<tr>")
-
Response.Write("<td>" & OpenLink("ASSOC_NAME") & "</td>")
-
Dim myNum
-
Dim int_desc
-
Dim desc_length
-
Dim int_status
-
myNum = 5
-
int_desc = OpenLink("FULL_NAME")
-
desc_length=len(int_desc)
-
If desc_length >0 Then
-
Response.Write("<td>" & int_desc & "</td>")
-
Else
-
Response.Write("<td><i>No Description entered in design</i></td>")
-
End If
-
int_status = InStr(status_text, "ACTIVE")
-
If int_status = 0 then
-
Response.Write("<td><b><font color=#FF0000>" & status_text & "</font></b></td>")
-
Else
-
Response.Write("<td>" & status_text & "</td>")
-
End If
-
Response.Write("</tr>")
-
-
OpenLink.MoveNext
-
Loop
-
-
OpenLink.Close
-
Set OpenLink = Nothing
-
Set adoCon = Nothing
-
%>
-
</table>
-
<!---
-
<%
-
set opls = CreateObject("SMSOPENLINK.SMSOPENLinkSession.1")
-
set oplc = CreateObject("SMSOPENLINK.SMSOPENLinkControl.1")
-
-
opls.ServerPort = "9027"
-
opls.AlertPort="9028"
-
opls.MachineName = "10.145.34.14"
-
opls.OpenPath 3, "OPL_USER"
-
retstatus = server.HTMLEncode(opls.LastStatus)
-
%>
-
--->
-
<!--- Server number = 3 --->
-
-
</body>
-
</html>
-
5 2385
You have to collect user entered data in ASP either through a submitted form, or a particular querystring link.
So for a drop down, the user would have to choose thier selection, then hit a submit button. Keep in mind however you can have the form action be set to submit to the very same page and just pass a flag to indicate that.
Once its submitted you can get the value. Even if you are populating your drop downs with javascript or using javascript to control thier interactions with it.
For example: -
<form action="mypage.asp" method="post">
-
<select name="dd1">
-
<option>Whatever</option>
-
</select>
-
<input type="hidden" name="Mode" Value="S">
-
<input type="submit" name="btnSubmit">
-
-
'Bottom line is just put the following code then at the top of your page to handle the collection of this data.
-
dim MyMode
-
dim MyDropDownValue
-
MyMode = request.form("Mode")
-
if MyMode = "S" then
-
'get your value
-
MyDropDownValue = request.form("dd1")
-
end if
-
-
Is this what you needed\help?
As a further comment to Jeff's excellent answer, you could also have your form automatically submit using javascript once an option was selected from the drop down.
Dr B
This is what I ended up doing. I've ran into another problem though, and not really sure how to get past it. The page I created needs to be refreshed every minute. When the page goes to refresh it pops up that message that data needs to be resent to the server. This is because I have a POST form on my page. How can I get around this so that the message doesn't come up, and the page automatically refreshes??
I don't believe it's possible to disable the message - it's there to stop people from accidentally resubmitting data which could lead to them doing things like paying for items twice.
I see two possible solutions to your problem. - Rather than refreshing the page when the timer hits the interval you could redirect the page to itself. You would lose any request variables (unless you passed them through the querystring) but you wouldn't get the re-posting message.
- You could use AJAX to refresh only the portion of the screen that you are interested in - check out this tutorial on the basics of AJAX for some more info.
Hope this helps,
Dr B
Thanks Dr B, I'll check out that link!!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: TNG |
last post by:
Hi,
Question, I use often a combo box on my ASP pages.
each time a form is submitted, the value of the combo box returns to the
first selection
But is there a way to avoid this and show always...
|
by: Nick Calladine |
last post by:
Is this possible to ...
I wish to get the value of a dropdown select but gets is indexable value
(dont know if that is the right term) if that is possible (the position it
assigned get assigned...
|
by: David Shorthouse |
last post by:
Folks,
I have a drop-down select menu generated server-side. I was hoping to
pass more than a single variable from the option value to a javascript
function. Is this possible? At the moment, my...
|
by: richardscheff |
last post by:
Video selector works for IE but not other browsers.
for not IE
<object ID='Player' data="video/dodgeball.wmv" type="video/x-ms-wmv"
width="320" height="280">
<param name="filename"...
|
by: james.calhoun |
last post by:
I feel like this should be really easy... I want a hidden field in a
form to have its value defined when someone clicks on a link.
So if they click on link "A" the value of the hidden field...
|
by: Gregc. |
last post by:
Hi
I am trying to but a function together whereby the user max a selection
and the selection appears in a box on the screen:
function goThere(){
var list = document.forms.toy1;...
|
by: IRC |
last post by:
hey, i am pretty new on javascript as well as PHP,
Hey, anyone can you help me, how to pass the javascript array value to
php page.........
i want to retrieve the values which are arrayed on...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |