Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1751
Number of posts: 4473

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
whats wrong in this code..help Posted by baarish on 1 Jun 2007 at 6:57 PM
iam trying a self submitting form,, everything is working.. i just need to write on the document what the error is.. e.g, if login is incorrect, it should write "incorrect" after the text box in red.. this is just a test page..
<%@ Language="VBSCRIPT" %>
<html>
<head>
<title>Sample</title>

<style type="text/css">
<!--
.style1 {font-family: Geneva, Arial, Helvetica, sans-serif}
-->
</style>

<script language="vbscript" runat="server">
dim err
err=false

If ucase(trim(request.ServerVariables("REQUEST_METHOD")))="POST" Then
if ( Request.form("login") = "asfia") then
Response.Redirect("hello.asp")
else
err = true
Response.Write(err)
End if
End if
</script>
</head>
<body >
<h1 align="center" class="style1" > APT System
</h1>
<form name="form1" method="post" action="<%Response.Write request.ServerVariables("SCRIPT_NAME")%>">
<table width="257" align="center" cellpadding="2" cellspacing="10" >
<tr valign="middle">
<td>Login </td>
<td><input type="text" name="login" tabindex="1" id = "login" value="<%Response.Write(Request.Form("login"))%>">
</td>
<!--<td><p style="color:red ">response.Write("err")<%if err = true then Response.Write("Incorrect login") end if %></p> </td>
</tr>-->
<tr>
<td>Password </td>
<td><input type="password" name="pass" tabindex="2" id="pass">
</td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Submit" tabindex="3" id="enter"></td>
</tr>
</table>
</form>
hello
<%Response.Write(err)%> THE PAGE DOESNT DISPLAY ERR STATE HERE..WHY?
</body>
</html>

Report
Re: whats wrong in this code..help Posted by CyGuy on 8 Jun 2007 at 9:03 AM
Probably want to look into using forms alittle more... here is how it is done: http://www.devguru.com/technologies/html/6262.asp
Although the language is client side, the call should be made to check for error just before it is submitted!


: iam trying a self submitting form,, everything is working.. i just
: need to write on the document what the error is.. e.g, if login is
: incorrect, it should write "incorrect" after the text box in red..
: this is just a test page..
: <%@ Language="VBSCRIPT" %>
: <html>
: <head>
: <title>Sample</title>
:
: <style type="text/css">
: <!--
: .style1 {font-family: Geneva, Arial, Helvetica, sans-serif}
: -->
: </style>
:
: <script language="vbscript" runat="server">This actually in the page?? if so are you going to name the Subroutine?
: dim err
: err=false
:
: If ucase(trim(request.ServerVariables("REQUEST_METHOD")))="POST" Then
: if ( Request.form("login") = "asfia") then
: Response.Redirect("hello.asp")
: else
: err = true
: Response.Write(err)
: End if
: End if
: </script>
: </head>
: <body >
: <h1 align="center" class="style1" > APT System
: </h1>
: <form name="form1" method="post" action="<%Response.Write
: request.ServerVariables("SCRIPT_NAME")%>">Here is where you will check the input with some call using the =onsubmit method
: <table width="257" align="center" cellpadding="2" cellspacing="10"
: >
: <tr valign="middle">
: <td>Login </td>
: <td><input type="text" name="login" tabindex="1" id = "login"
: value="<%Response.Write(Request.Form("login"))%>">
: </td>
: <!--<td><p style="color:red ">response.Write("err")<%if err =
: true then Response.Write("Incorrect login") end if %></p> </td>
: </tr>-->
: <tr>
: <td>Password </td>
: <td><input type="password" name="pass" tabindex="2" id="pass">
: </td>
: </tr>
: <tr>
: <td><input type="submit" name="Submit" value="Submit"
: tabindex="3" id="enter"></td>
: </tr>
: </table>
: </form>
: hello
: <%Response.Write(err)%> THE PAGE DOESNT DISPLAY ERR STATE HERE..WHY?Not of text datatype
: </body>
: </html>
:
:



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.