Link to home
Start Free TrialLog in
Avatar of APD Toronto
APD TorontoFlag for Canada

asked on

Request.Form returns empty

Hello Experts,

Can anyone give me any ideas why would Request.Form not return anything? All my control names are spelled correctly (I used copy/paste), but I cannot think of what could be the issue?

I have recently installed Visual Studio 2010 on my computer, could that be conflicting in any way? What else can I check?

Thank you,
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of APD Toronto

ASKER

tax1 returns empty at Respone.Wrie

<%@ Language=VBScript %>

<!-- #include file="../includes/common.asp" -->
<!-- #include file="../includes/checklogin.asp" -->
<!-- #include file="../includes/functions.asp" -->
<!-- #include file="../includes/AdminPageSetup.asp" -->

<%
	strAction = Injection(Request.QueryString("action"))

	If strAction = "save" Then
	
		'Request Prices
		
		
		'Request Taxes
		  
		  '***TAX 1***
		  
			strTaxName1 = (Request.Form("txtTaxName1"))
			strTaxRate1 = Injection(Request.Form("txtTaxRate1")) 
			
			If Injection(Request.Form("chkTaxActive1")) = "1" Then
			
				strTaxActive1 = True
			
			Else
			
				strTaxActive1 = False
			
			End If
		
		  '***TAX 2***
		  
			strTaxName2 = Injection(Request.Form("txtTaxName2"))
			strTaxRate2 = Injection(Request.Form("txtTaxRate2")) 
			
			If Injection(Request.Form("chkTaxActive2")) = "1" Then
			
				strTaxActive2 = True
			
			Else
			
				strTaxActive2 = False
			
			End If
			
		'***TAX 3***
		  
			strTaxName3 = Injection(Request.Form("txtTaxName3"))
			strTaxRate3 = Injection(Request.Form("txtTaxRate3")) 
			
			If Injection(Request.Form("chkTaxActive3")) = "1" Then
			
				strTaxActive3 = True
			
			Else
			
				strTaxActive3 = False
			
			End If
		
		Response.Write("tax1 =" & strTaxName1)
			
		'Call Save
	
	Else
		
		strMSG = "Your changes have been cancelled."
		
	End If

Open in new window

As long as you have something like this, you should be good to go.
However, like Dave pointed out, if you do have code like this, then we will need to see and no more.

(Just copy and paste into a new file, name it Q_27993404.asp
And then run it.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<%getSub = request.Form("Submit")
if request.Form("Submit")="Send Data" then
fname = request.Form("FName")
lname = request.Form("LName")
response.Write "You entered <strong>"&fname&" "&lname&"</strong> as your name"
end if
%>
<form action="Q_27993404.asp" method="post" name="Process">
<input type="text" name="FName" />
<input type="text" name="LName" />
<input type="submit" name="Submit" value="Send Data" />
</form>
</body>
</html>

Open in new window


Carrzkiss
My test is Li. 63

My HTML form is below, but could this be related as well: https://www.experts-exchange.com/questions/27993401/Classic-ASP-and-JIT.html

HTML
<%@ Language=VBScript %>

<!-- #include file="../includes/common.asp" -->
<!-- #include file="../includes/checklogin.asp" -->
<!-- #include file="../includes/functions.asp" -->
<!-- #include file="../includes/AdminPageSetup.asp" -->

<%
Call openDB
Set rs = Server.CreateObject("ADODB.Recordset")
With rs

	strSQL = "SELECT * FROM tblTaxes ORDER BY fldID ASC;"
	.Open strSQL, cnn
	
		.MoveFirst 'TAX1
		
			strTaxName1 = .Fields("fldName")
			strTaxRate1 = CDbl(.Fields("fldRate")) * 100
			strTaxActive1 = .Fields("fldActive")
			
		.MoveNext 'TAX2
		
			strTaxName2 = .Fields("fldName")
			strTaxRate2 = CDbl(.Fields("fldRate")) * 100
			strTaxActive2 = .Fields("fldActive")
	
		.MoveNext 'TAX3
		
			strTaxName3 = .Fields("fldName")
			strTaxRate3 = CDbl(.Fields("fldRate")) * 100
			strTaxActive3 = .Fields("fldActive")
	.Close
End With
Set rs = Nothing
Call closeDB
%>

<%Call getHeader%>
	
	<h1> <center> Prices & Taxes </center> </h1>

<form method="POST" action="changeRates-save.asp?action=save" name="frm" onSubmit="return validate();" enctype="multipart/form-data">

<center>

	

</center>
<b><i> *IMPORTANT: All above prices should be pre-tax and pre-promo, including pre-1111.</i></b>

<br> &nbsp;<br> &nbsp;

<center>

<table width="50%"> <!--REDUCE LATER-->
	
	<tr>
		<td width="25%"> &nbsp; </td>
		<td width="25%" bgcolor="#C0C0C0" align="center"> <b> Tax #1 </b> </td>
		<td width="25%" bgcolor="#C0C0C0" align="center"> <b> Tax #2 </b> </td>
		<td width="25%" bgcolor="#C0C0C0" align="center"> <b> Tax #3 </b> </td>
	</tr>
	
	<tr>
		<td> Name: </td>
		<td> <input type="text" size="5" name="txtTaxName1" id="txtTaxName1" value="<%=strTaxName1%>" /> </td>
		<td> <input type=text size=5 name="txtTaxName2" id="txtTaxName2" value="<%=strTaxName2%>"> </td>
		<td> <input type=text size=5 name="txtTaxName3" id="txtTaxName3" value="<%=strTaxName3%>"> </td>
	</tr>
	
	<tr>
		<td bgcolor="#C0C0C0"> Rate: </td>
		<td bgcolor="#C0C0C0"> <input type=text size=5 name="txtTaxRate1" id="txtTaxRate1" value="<%=strTaxRate1%>"> % </td> 
		<td bgcolor="#C0C0C0"> <input type=text size=5 name="txtTaxRate2" id="txtTaxRate2" value="<%=strTaxRate2%>"> % </td> 
		<td bgcolor="#C0C0C0"> <input type=text size=5 name="txtTaxRate3" id="txtTaxRate3" value="<%=strTaxRate3%>"> % </td> 
	</tr>
	
	<tr>
		<td> Active: </td>
		
		<td>
			<input type=checkbox name="chkTaxActive1" id="chkTaxActive1" value=1
				
				<%If CBool(strTaxActive1) Then Response.Write("checked")%> >
			
		</td>
		
		<td>
			<input type=checkbox name="chkTaxActive2" id="chkTaxActive2" value=1
				
				<%If CBool(strTaxActive2) Then Response.Write("checked")%> >
			
		</td>
		
		<td>
			<input type=checkbox name="chkTaxActive3" id="chkTaxActive3" value=1
				
				<%If CBool(strTaxActive3) Then Response.Write("checked")%> >
			
		</td>
	</tr>

<table>

</center>
<b><i> *IMPORTANT: Inactive (un-checked) tax rates will NOT be charged.</i></b>


<br> &nbsp;<br> &nbsp;
<center>

	<INPUT type="submit" value="Save Changes" id=submit1 name=submit1> &nbsp; &nbsp; 
	<INPUT type="button" value="Cancel Changes" onClick="cancelChanges();" id=button1 name=button1>

</center>
<br> &nbsp;<br> &nbsp;

</form>

<%Call getFooter%>

<script type="text/javascript">

function validate()
{

	alert ('is everything validated?');
	return true;
}

function cancelChanges()
{
	if (confirm("Are you sure you want to cancel these changes?")) 
	{
		self.location = "changeRates-save.asp?action=cancel";
	}
}

</script>

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
strAction = Request.QueryString("action") works as i get
tax1 =
On my screen, meaning Li. 63 executes
As for the JIT, I am not sure if it will have anything to do with it.
As I had Visual Studio 2010 installed back mid-last year, and did not experience any issues with my classic ASP projects.
So you are saying the running the test works, and you get back a result.
If that is true, then try it with your header of the file, and then include the protection
strAction = Injection(Request.QueryString("action"))
And try it again.
You want to test everything, to make sure that it all passes.
Then you can start looking into your other code on that page, to see if something else is stopping it from going through.

p.s.
It seems we are posting on top of each others comments :)
I removed   enctype="multipart/form-data" and it worked.
Sometimes it is the little things.
Do you know what you was using that for?
As it might be needed on something, however, you can place it elsewhere, besides where you initially had it at.

Glad you got it working.
Carrzkiss