|
 |
asp_web_howto thread: IF statement or ASP code not working
Message #1 by "Kathy Burke" <burkek@g...> on Fri, 19 Oct 2001 20:04:23
|
|
Hi. I'm fairly new to this so please bear with me...
The following code presents fine on the HTML side, but when I click
the "The Variable Is" button, the MsgBox always returns "Hello No", even
when I first click on a "yes" radio button in the TestPass1 form field. It
appears that either I'm not retrieving the Request.Form(TestPass1)
contents correctly or the IF/Else statement is wrong. Any help greatly
appreciated! I'm trying to figure out how to determine a certain variable
(which will be posted to a db eventually) such as "If all 3 fields
are "yes" then var = "yes", otherwise "no".
thanks, kathy
<INPUT TYPE="button" NAME="button1" VALUE="The variable is"
onCLICK="TestData()">
</FORM>
<%
strTest1 = Request.Form("TestPass1")
strTest2 = Request.Form("TestPass2")
strTest3 = Request.Form("TestPass2")
%>
<Script language="vbs">
Sub TestData()
If strTest1 = "yes" then
some_variable = "hello yes"
msgbox some_variable
Else
some_variable = "hello no"
msgbox some_variable
End if
End sub
</Script>
Message #2 by "Drew, Ron" <RDrew@B...> on Fri, 19 Oct 2001 17:52:01 -0400
|
|
<head>
<script language="javascript">
<!-- for old browsers
function CheckForm() {
if (document.test.TestPass1.value == "yes")
{
alert("Say YES");
document.test.TestPass1.focus();
return (false);
}
if (document.test.TestPass1.value == "no")
{
alert("Say NO");
document.test.TestPass1.focus();
return (false);
}
return (true);
}
-->
</script>
<body>
<form METHOD="post" ACTION="test3.asp" NAME=test>
<input type=text name="TestPass1">
<INPUT TYPE="button" NAME="button1" VALUE="The variable is" onClick="return
CheckForm()">
</FORM>
-----Original Message-----
From: Kathy Burke [mailto:burkek@g...]
Sent: Friday, October 19, 2001 4:04 PM
To: ASP Web HowTo
Subject: [asp_web_howto] IF statement or ASP code not working
Hi. I'm fairly new to this so please bear with me...
The following code presents fine on the HTML side, but when I click
the "The Variable Is" button, the MsgBox always returns "Hello No", even
when I first click on a "yes" radio button in the TestPass1 form field. It
appears that either I'm not retrieving the Request.Form(TestPass1)
contents correctly or the IF/Else statement is wrong. Any help greatly
appreciated! I'm trying to figure out how to determine a certain variable
(which will be posted to a db eventually) such as "If all 3 fields
are "yes" then var = "yes", otherwise "no".
thanks, kathy
<INPUT TYPE="button" NAME="button1" VALUE="The variable is"
onCLICK="TestData()">
</FORM>
<%
strTest1 = Request.Form("TestPass1")
strTest2 = Request.Form("TestPass2")
strTest3 = Request.Form("TestPass2")
%>
<Script language="vbs">
Sub TestData()
If strTest1 = "yes" then
some_variable = "hello yes"
msgbox some_variable
Else
some_variable = "hello no"
msgbox some_variable
End if
End sub
</Script>
|
|
 |