ASP

80K

Solutions

7

Articles & Videos

31K

Contributors

Active Server Pages (ASP) is Microsoft’s first server-side engine for dynamic web pages. ASP’s support of the Component Object Model (COM) enables it to access and use compiled libraries such as DLLs. It has been superseded by ASP.NET, but will be supported by Internet Information Services (IIS) through at least 2022.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hello experts, I'm trying to develop a code that can manipulate the cursor to transfer from one input text to another. The big problem is that the input text that i have is in the table. The Table is made thru insertRow. Therfore, they are in the same id. So, I try to make an index to determine which of them is being click. I attached the code below to make you (experts) understand of what i am trying to do. Please help me achieve the goal if is possible. My goal is to let the cursor focus from one input text to another by using arrow-up, arrow-down, left and right. Thank you!

<!DOCTYPE html>
<html>
<style>
table,th,td {
  border : 1px solid black;
  border-collapse: collapse;
}
th,td {
  padding: 5px;
}
tfoot {color:red;}
</style>

<table id="Tab1">
<tr>
  <th>Quantity</th>
  <th>Price</th>
  <th>Total</th>
</tr>
</table>

<br/>

<button onclick="return AddNow()">Add row</button>


<script>
function AddNow() {

  var p = parseInt("2.50");
  
  var table = document.getElementById("Tab1");
  var row = table.insertRow(table.rows.length);
  
  var cell1 = row.insertCell(0);
  var cell2 = row.insertCell(1);

  cell1.innerHTML = '<input type="text"  id="qty" class="Qty"  onkeydown="myIndex(this)"/>';
  cell2.innerHTML = '<input type="text" id="rp"  value="' + p + '"' + ' readonly/>'; 

}
</script>


<script>
function myIndex(x)
{
  var h = x.parentElement.parentElement.rowIndex; 
  alert(h);
  // here focus() must transfer to the next row depending on the user choice 

Open in new window

0
Free Tool: Site Down Detector
LVL 9
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Hi experts, how to make codes that will give information of the browser, client side?

<!DOCTYPE html>
<html>
<body>


<button onclick="GetBrowserName()">Get Browser name</button>

<script>
function GetBrowserName() {
    
    alert("You're browser name is");
}
</script>

</body>
</html>

Open in new window

0
Hello there I have looked through the interweb and cannot seem to find anything except TRIM to remove spaces.

Unfortunately Trim remove pre and post spaces, which I do not require

I was to remove the spaces within a field

eg. Te Awe Awe Gardner --> TeAweAweGardner

Any help would be great
0
Hi Experts,

I am trying to update legacy ASP code amd I am starting out with
<%@ Language=VBScript %>

<%
Session("isLocal") = True

Session("getRates") = ""
Session("getRatesTime") = DateAdd("n", -1, Now())	'DateAdd Intervals: s=secs; n=minutes; h=hrs

Session("Root") = "../"
Session("sourceID") = 1

If (Session("isLocal") = True) Then   
    %>

    <!--  <!-- #include file = "../../CSSN_subdomains/includes/common.asp" -->
    <!--  <!-- #include file = "../../CSSN_subdomains/includes/functions.asp" -->
    <!--  <!-- #include file = "../../CSSN_subdomains/includes/PageSetup.asp" -->

    <%
Else
    %>

    <!--  <!-- #include virtual = "/includes/common.asp" -->
    <!--  <!-- #include virtual = "/includes/functions.asp" -->
    <!--  <!-- #include virtual = "/includes/PageSetup.asp" -->

    <%
End If

Open in new window


However, I am getting the following error despite that Session("isLocal") is True, so lines 23-25 should never be executed.
Active Server Pages error 'ASP 0126'

Include file not found

/CSST_subdomains/cart.citysightseeingtoronto.com/index.asp, line 23

The include file '/includes/common.asp' was not found.

Open in new window


What is going on?

Any help will be greatly appreciated.
0
We've got a few old customers that, believe it or not, still have old classic ASP sites.   We recently began to migrate them from SQL 2012 to Azure SQL Database.  After the database migration, we get the following errors on the sites:

Server Native Client 11.0][SQL Server]The request for procedure '[tablename]' failed because '[tablename]' is a table object.

I figure at this point there has to be a fix for this however I cannot seem to locate it.

Anyone have the magic bullet?
0
<form method="post" action="contact.asp">
                        <b>Envíenos un mensaje</b> <span></span>
                        <input type="text" name="fname" id="fname" value="Nombre">
                        <input type="text" name="email" id="email" value="Dirección de Email">
                        <select name="Consultorio">
                            <option>Elija Consultorio...</option>
                            <option>Queretaro</option>
                            <option>San Miguel</option>
                        </select>
                        <textarea name="message" id="message" cols="30" rows="10">Escriba aquí su mensaje...</textarea>
                        <input type="submit"  name="send" id="send" value="Enviar Mensaje">
                    </form>

how do i set a input name in the select in order to asp read the select option?
regards
0
After this code runs and adds a record to the recordset, I am unable to add any more entries into the record. I believe the record is getting locked by the database since it detected changes, but I'm not sure how to remove that through access. I have verified this code works properly besides the unintended side effect of being unable to repeatedly do it. Does anyone know how to unlock the record so everyone can access it after this runs?

    Set ClientRS = CurrentDb.OpenRecordset("Client Contacts", dbOpenDynaset, dbSeeChanges)
   
    With ClientRS
        .AddNew
        ![id] = ClientID
        ![Full Name] = FullName
        ![Phone Number] = PhoneNumber.Value
        ![Company] = "Other"
        .Update
        .Close
    End With

    Set ClientRS = Nothing
   
    DoCmd.Close acForm, "Add Phone Record", acSavePrompt
End Sub
0
Hi experts, I wish to add 1 day on the edate I have coded below. Something like this (edate + 1). can i do this? Thanks!


Set rs = cn.Execute("Select Proname, REMARK, TheDate, INPro, OUTPro, BALANCE from Stock where PROCODE='" & code & "' And TheDate Between '" & sdate & "' And '" & edate & "' Order by icount")
0
Is this even possible?

I have select dropdown A containing - among other things - value x.
I have text input field B which is empty by default.

Now, if x in A is selected I want to check if B has a value. In a perfect scenario I would also want to check if B has a specific value.

Possible? If so - how? I can do the basic validate form stuff, but this turns into a if/and/then scenario that I'm unfamiliar with.

Best regards
Michael
0
Hi,

We have a login page that saves a cookie so that the username is stored and shows next time the user logs in.
We ran a security scan and got the following alert:

"Cookie without 'httpOnly" flag

Below is the code for setting up the cookie. How can we resolve the issue of the alert?

        function createCookie(name, value, days) {
            if (days) {
                var date = new Date();
                date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
                var expires = "; expires=" + date.toGMTString();
            }
            else var expires = "";
            document.cookie = name + "=" + value + expires + "; path=/";
        }

        function eraseCookie(name) {
            createCookie(name, "", -1);
        }

Open in new window

0
Technology Partners: We Want Your Opinion!
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

The title pretty much says it all.  I created my array as follows:


' Multidimensional Array
	' arrTransactions(col,row)
	ReDim arrTransactions(6,0) 

	
	' SQL Statement
	strSQLStatement = 	"SELECT transactionNumber, jobNumber, eventName, collateralID, arrivalDate, returnDate, quantity " & _  
						"FROM collateralOut " & _
						"WHERE collateralID  ='" & strCollateralID & "' " & _
						"ORDER BY arrivalDate DESC" 

	' Connection
	Set conn = Server.CreateObject("ADODB.Connection")
	conn.open connectionStr

	' Create our recordset
	set strFilename=Server.CreateObject("ADODB.recordset")
	strFilename.Open strSQLStatement, conn

	If Not strFilename.EOF Then
		strFilename.MoveFirst
		
		noRecord = "False"
		
		i = 0

		While Not strFilename.EOF

			arrTransactions(0,i) = strFilename.Fields("transactionNumber").Value
			arrTransactions(1,i) = strFilename.Fields("jobNumber").Value
			arrTransactions(2,i) = strFilename.Fields("eventName").Value
			arrTransactions(3,i) = strFilename.Fields("collateralID").Value
			arrTransactions(4,i) = strFilename.Fields("arrivalDate").Value
			arrTransactions(5,i) = strFilename.Fields("returnDate").Value
			arrTransactions(6,i) = strFilename.Fields("quantity").Value

			' Counter
			i = i + 1
			
			' Preserve array position
			ReDim Preserve arrTransactions(6,i)

			' Move to the next record
			strFilename.MoveNext
		Wend
		
	Else
		noRecord = "True"
	End If
	
	' Close our connection
	strFilename.Close
	Set strFilename = Nothing

Open in new window



Then I wrote the following to loop through the array but it's not working:
                 <table border="1" cellpadding="5" cellspacing="1" width="80%">
                 	<tr>
                    	<td bgcolor="#eeeff0"><strong>Trans#</strong></td>
                        <td bgcolor="#eeeff0"><strong>Event Name</strong></td>
                        <td bgcolor="#eeeff0"><strong>Event Start</strong></td>
                        <td bgcolor="#eeeff0"><strong>Qty Ordered</strong></td>
                    <tr>
                 	<%
						If NoRecord = "False" Then
							For i=0 to (UBOUND(arrTransactions) - 1)
					%>
					<tr>
                    	<td valign="top"><%= arrTransactions(0,i) %></td>
                  		<td><%= HTMLDecode(arrTransactions(2,i) ) %></td>
                        <td valign="top"><%= arrTransactions(4,i) %></td>
                        <td valign="top" align="center"><%= arrTransactions(6,i) %></td>	
                    </tr>
					<%
							Next
						Else
					%>
					<tr>
                    	<td colspan="5"><strong>No Records Found</strong></td>
					</tr>
					<%
					End If 
					%>
                </table>

Open in new window


When I load the page it only loads 6 records and stops.  There are about 30 records the page should be displaying.  

I have a feeling that this line here is wrong...

For i=0 to (UBOUND(arrTransactions) - 1)

Open in new window


... but I'm not sure how to fix it.  Can someone please help me?
0
I think I know the answer to my question but I am asking it anyway (I know one is file  - xdDoc.Load and one is string xdDoc.LoadXml etc)
I have a variable that contains an XML formatted string.
Normally I would load XML from a file, using the following code:
	set xdDoc = Server.CreateObject("MSXML2.DOMDocument.6.0")
         xdDoc.load(strSource)

Open in new window


But the foregoing code fails when I use a XML string.
The following code works for the XML string and why is that??
AM I using the correct version for "Microsoft.XMLDOM"
I know I am okay with "MSXML2.DOMDocument.6.0"

   set xdDoc = CreateObject("Microsoft.XMLDOM") 
   xdDoc.LoadXml(strSource)

Open in new window

0
I am using a modified HTML form provided by Insightly on a website to capture data, do a Google reCAPTCHA verification, and then POST the data to Insightly. All of the text data is posting correctly, but the checkboxes are not. I am doing this with Classic ASP. The script which sends the data looks like this:

<%	set objXML=server.createobject("MSXML2.ServerXMLHTTP")

	objXML.Open "POST", "https://googleapps.insight.ly/WebToLead/Create", False
	objXML.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
	objXML.Send data

	response.write(objXML.responseText) %>

Open in new window


The HTML checkboxes (as provided by Insightly) look like this:

<label for="insightly_LEAD_FIELD_23">St. Mary's </label><input id="insightly_LEAD_FIELD_23" name="LEAD_FIELD_23" type="checkbox" />

Open in new window


I am capturing the user's input and attempting to post the result to Insightly, however the checkbox data is not passing through. There is no "value" attribute in the checkbox, so I'm not sure what to send.

The value of the "data" variable in the first bit of code above looks like this:

formId=xxx&FirstName=Sample+First+Name&LastName=Sample+Last+Name&email=me%40domain%2Ecom&phone=1234567890&LEAD_FIELD_22=abc%0D%0A123&ResponsibleUser=510943&LeadSource=28860&LEAD_FIELD_16=&LEAD_FIELD_21=&LEAD_FIELD_17=&LEAD_FIELD_23=

I have also tried a variable on that data, which also does not work, like this:

formId=xxx&FirstName=Sample+First+Name&LastName=Sample+Last+Name&email=me%40domain%2Ecom&phone=1234567890&LEAD_FIELD_22=abc%0D%0A123&ResponsibleUser=510943&LeadSource=28860&LEAD_FIELD_16=&LEAD_FIELD_21=&LEAD_FIELD_17=&LEAD_FIELD_23=St+Marys

The variables generally ARE working, such as FirstName, LastNAme, email, etc. Its the LEAD_FIELD_XX fields which I am not able to populate correctly.

Any idea what I could be doing wrong? Thanks!
0
Hi.

I have this webdatabase made in classic asp/VBscript, and when a specific page is loaded into an iframe, I want to refresh the parent page after some SQL-codes has been executed. Why? Because the SQL update info on the parent page.
How can I do that built into the SQL precedure?? Is there a VBscript that can do the job? I know there's javascripts, but as far as I know I can't mix that up with the asp/VBscript.
I hope there's a solution out there. :-)

Best regards

Ulrich
0
Hi Expert,

In a ASP page this is normally not a problem but jquery mobile seems to make this a little harder.
I'd like to load a popup from a jquery mobile page and fill in a form, submit it, store my value into a DB (left out in my example file) and then close the popup and refresh the initial index.html page.  

<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Cache-Control" content="no-store" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../css/themes/default/jquery.mobile-1.4.5.min.css">
<script src="../js/jquery/jquery.js"></script>
<script src="../_assets/js/index.js"></script>
<script src="../js/jquery/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="main" id="ui-content" class="ui-content">
<a href="#popupnieuw" data-rel="popup" data-position-to="window" data-transition="pop"  data-mini="true" data-inline="true" data-theme="b" data-corners="true" data-shadow="true" data-wrapperels="span" class="ui-btn ui-btn-inline ui-icon-plus ui-btn-icon-left">Een onderwijs behoefte toevoegen</a>
<div data-role="popup" data-history="false" id="popupnieuw" data-dismissible="false" data-overlay-theme="b" data-theme="a" data-corners="false" data-tolerance="15,15">
<div data-role="header" data-theme="a">
<a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" data-position-to="window" class="ui-btn-right">Close</a>
<h1>Een nieue wens</h1>
</div>			

Open in new window

0
I have a Windows 2012R2 server. I ran a PCI scan and the only vulnerability I found was " The Web server can be triggered to reveal the absolute path for the Web root directory and/or other software installed on the host"

The application we host requires parent paths to be enabled in IIS. I am not sure if this is causing the issue and if it is then what needs to be done with the application in order to be able to disable parent paths.

How can I resolve this issue?
0
Hi,

I have to relaunch a classic asp site we built a few years ago. The following is the script I used that worked before, I am nor sure why it now only works for a small file, when the file is larger, I am getting "this page cannot be displayed"error. This script is to let user download the file that just created. When I received the error, the file was generated on the server.  thanks

<%@Language="VBScript"%>
<%'Option Explicit%>
<%
If session.sessionid <> application(session("appvariable")) then 
	session.Abandon
	Response.Redirect "login.asp"
end if	
%>
<%Response.Buffer = true%>
<%
On Error Resume Next
Dim strPath
strPath = CStr(Request.QueryString("file"))

on error resume next
	if (request.querystring("EXCELZIPALL")=1) then
		filePath= Server.mapPath("../EXCELReports/EXCELBatchList") & "\"&replace(trim(SESSION("Companyname")),"@","-") & "-" & trim(SESSION("UserName"))
	else
		filePath= Server.mapPath("../EXCELReports")
    end if
if err.number<>0 then
	response.write err.description
	response.end
end if


'-- do some basic error checking for the QueryString
If strPath = "" Then
  Response.Clear
  Response.Write("No file specified.")
  Response.End
ElseIf InStr(strPath, "..") > 0 Then
  Response.Clear
  Response.Write("Illegal folder location.")
  Response.End
ElseIf Len(strPath) > 1024 Then
  Response.Clear
  Response.Write("Folder path too long.")
  Response.End
Else
  Call DownloadFile(strPath)
End If
  
Private Sub DownloadFile(file)
  '--declare 

Open in new window

0
I need to convert seconds, out to the thousandths, to hh:mm:ss.xxx format.  I have a script that comes close but I believe it chops off the decimal seconds.  Can someone give me an alternative or show how to modify this one pleaes?

Function SecondsToTime(ByVal sglScnds)
  Dim hours, minutes, seconds

  ' calculates whole hours (like a div operator)
  hours = sglScnds \ 3600

  ' calculates the remaining number of seconds
  intSeconds = sglScnds Mod 3600

  ' calculates the whole number of minutes in the remaining number of seconds
  minutes = sglScnds \ 60

  ' calculates the remaining number of seconds after taking the number of minutes
  seconds = sglScnds Mod 60

  ' returns as a string
  SecondsToTime = hours & ":" & minutes & ":" & seconds
End Function

Open in new window


Thank You!
1
I have a looping  array that outputs all necessary data from table . I need to take that looped array and output it in a single string that I can use later in some other code .

Set Products_cmd = Server.CreateObject ("ADODB.Command")
Products_cmd.ActiveConnection = dbHistory
Products_cmd.CommandText = "SELECT * FROM organic WHERE isActive=0" 
Products_cmd.Prepared = true

Set Products = Products_cmd.Execute

Dim arrProducts
arrProducts = Products.GetRows()

dim i
For i = 0 to ubound(arrProducts, 2)
   response.write( trim(arrProducts(1,i))+"," )
next

myNewVar_organic=???

Open in new window


Thanks in advance
0
Salesforce Has Never Been Easier
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Hi,

I am hoping someone can help me with an issue I am having whilst using Jquery and Classic ASP.

This code works perfectly..


  <script type="text/javascript">

    $(document).ready(function() {
             $('ul.sf-menu').sooperfish();
    });

</script>


BUT as soon as I add in the code for my ajax form submit it does not work..


  <script type="text/javascript">
    $(document).ready(function() {
       
        
         $('#submitButton').click(function() {
    $.ajax({
            type: "POST",
            url: "test.asp",
            data:  $("#form1").serialize(),
            cache: false,
            dataType: "html",
            success: function(responseText){
                alert(responseText);
            },
            error: function(resposeText){
                alert(resposeText);
            },
        });

    return false;
});

        
             $('ul.sf-menu').sooperfish();
 
    });
0
Hi,

I am trying to use classic ASP on IIS6 on Win7. I went to control panel->Programs->Tuen win features on or off->IIS->App Dev Features

After checking ASP/ASP.NET.....  I needed to reboot, but after rebooting, they were unchecked again.

any ideas?  thanks
0
Hello all;

I found the following
http://www.evagoras.com/2011/02/07/formatting-complex-asp-output-using-html-templates/
Which works rather well, but I seem to run into an issue, where not all the values get replaced.

Example
   strText = Replace(strText, "REPLACE_Name", strName)
   strText = Replace(strText, "REPLACE_Email", strEmail)

Open in new window


So, if I change the top one, to another word here, and in the HTML Template.
It will not update, and change.

I have restarted IIS, to see if maybe there was an issue there.
And nothing.

So.
Is there another way to do this, where I can change the template values with records from the database?
That will work better than this one?

By the way, the article in the link uses the old CDONTS
I use CDOSYS.

This is my Replace, that I am doing.
I have it marked on the ones that work and do not work.


Function ReadFile(filename)
  Dim objFSO
  Dim objTStream
  Dim strText
  Const ForReading = 1

  Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    Set objTStream = objFSO.OpenTextFile(Server.MapPath(filename), ForReading)
      strText = objTStream.ReadAll
    Set objTStream = Nothing
  Set objFSO = Nothing
  strText = Replace(strText, "REPLACE_url", theurl) ' >>>>>>Dosn't Works
  strText = Replace(strText, "REPLACE_siteName", siteName) ' >>>>>>Dosn't Works
  strText = Replace(strText, "REPLACE_Welcome", theMessage) ' >>>>>>Dosn't Works
  strText = Replace(strText, 

Open in new window

0
In my classic ASP application I have to read a number from database and again write it to another table in the database.
when the number is larger than long, I converted it to number using csng function. But it has converted to scientific notation and the number has not been written to the database correctly.

correct number                              Incorrect number
101304333                                       101304300
101503485                                       101503500
1171100103                                     1171100100
0
When I disable TLS 1.0 my classic ASP application connection doesn't connect to my SQL 2014 server.  I can use the ODBC GUI to create the connection successfully but when using that DSN or specifying the connection properties in my ASP connection string it fails to connect.  I've enabled and installed all of the ASP.NET, SQL Native Client and ODBC updates to allow TLS 1.2 but it's still not working when I disable TLS 1.0.
0
Hello, I tried to ask this question earlier, but after bumping my head a few times with the responses I've decided to ask the question in a different way:

I'm looking for a variable length (dynamic length) jQuery/javascript currency mask. The mask needs to do the following:

  • Pre fill with a '$' (dollar sign) any other pre-filled values are welcomed (commas, decimal point etc.)
  • Only allow numeric input and or commas and a decimal point
  • allow for any size number (within reason: millions is probably as far as it will need to go), but not force a minimum size number. i.e: you can enter $1,000,000,000.00 or you can enter $1.00 anything in between
  • I need to be able to plug and play: if i need the js file, I can get that

I would prefer code examples or jfiddle examples if possible. I don't work with and or use jQuery / javascript regularly so retro-fitting code to do what I need it to do is probably going to take more time than I'm willing to invest. Please help.
0

ASP

80K

Solutions

7

Articles & Videos

31K

Contributors

Active Server Pages (ASP) is Microsoft’s first server-side engine for dynamic web pages. ASP’s support of the Component Object Model (COM) enables it to access and use compiled libraries such as DLLs. It has been superseded by ASP.NET, but will be supported by Internet Information Services (IIS) through at least 2022.