Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-20-2006, 10:59 PM   PM User | #1
bspahr
New Coder

 
Join Date: Apr 2003
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
bspahr is an unknown quantity at this point
Session Variable

I am working on this page. I am pulling the session variable "test" from the previous page which is a number. If they enter that number on this page I want an alert to display saying that they cannot enter there on number. Can't seem to get it to work though.




Code:
<%@Language=VBScript %>

<%
		test = Session("test")
%>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>

<script language="javascript">
	function chkForm() {
		var test = document.frmOrder.test.value;
		var SessionName = document.frmOrder.SessionName.value
		
		// Check Number
		if (test.value =SessionName) {
			alert('You cannot enter this number');
			return false
		}	

	}
</script>

</head>
<body>



			
<form name="frmOrder" method="post" action="return.asp" onSubmit="return chkForm();">
<input type="hidden" name="SessionName" value="<%=test%>">



<table bgcolor="#ffffff" border="0" width="250" cellspacing="1" cellpadding="2" class="main">
<tr>
<td bgcolor="#FFFFFF">Test:</td>
<td bgcolor="#FFFFFF"><input type="text" name="test" maxlength="5" size="5"></td>
</tr>
</table>


<input type="Submit" value="Continue" name="Continue"><br>


</body>
</html>
bspahr is offline   Reply With Quote
Old 10-21-2006, 08:48 AM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,103
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
if (test.value ==SessionName)
Philip M is offline   Reply With Quote
Old 10-23-2006, 03:19 PM   PM User | #3
bspahr
New Coder

 
Join Date: Apr 2003
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
bspahr is an unknown quantity at this point
Thanks, but it is still not working.
bspahr is offline   Reply With Quote
Old 10-23-2006, 03:30 PM   PM User | #4
mutale
New to the CF scene

 
Join Date: Oct 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
mutale is an unknown quantity at this point
test already point to the value...

try

if (test == SessionName)
mutale is offline   Reply With Quote
Old 10-23-2006, 03:35 PM   PM User | #5
bspahr
New Coder

 
Join Date: Apr 2003
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
bspahr is an unknown quantity at this point
That did it! Thanks.
bspahr is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:32 AM.


Advertisement
Log in to turn off these ads.