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 2408 jeffstl 432
Recognized Expert Contributor
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 your latest selection ?
Thx in advance
TNG
|
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 the position on the list)
this is so i can then pass it to the array called pictureimage to get the
correct filename (similar to the picturetext part of this routine) and then
the final line on the fuction is to change an original image with...
|
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 option values consist of three
numbers separated by commas. I thought I could pass these three numbers as
three distinct variables to the javascript function, but it obviously
doesn't work this way.
e.g.
|
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" value="video/dodgeball.wmv" />
<param name="ShowControls\" value="1" />
<param name="AutoStart\" value="1" />
<param name="PlayCount\" value="1" />
|
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 becomes "A",
while if they click "B" the value of hidden field becomes "B"
Help?
| |
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;
location.href=list.options;
}
|
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 "selectedValues"
from next page for php variable
this is my javascript code saved on "sendValue.js" file,
<script>
function updateRecordEntry(requestValue){
|
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...
|
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,...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |