How to validate textbox in coldfusion8.0
Hello,this is Mr-Bat with another problem. The problem is this time with my login page code when i type nothing in textbox then also on clicking login button i can acess homepage.the code for login is as folows:
<cfform action="Home.cfm" method="post" name="LoginForm.cfm" >
<table align="center" border="1" bgcolor="#CCCCCC" bordercolor="#000000" cellpadding="3" cellspacing="2">
<tr bgcolor="#FF9797">
<th colspan="2"><div align="center"><strong>Login</strong></div></th>
</tr>
<tr>
<th>Login name </th>
<td><div align="center">
<cfinput type="text" name="Login" size="20" maxlength="35" required="yes">
</div></td>
</tr>
<tr>
<th>Password</th>
<td><div align="center">
<cfinput type="password" name="password" size=20 maxlength="35" required="yes">
</div></td>
</tr>
<tr>
<th height="28" colspan="2">
<div align="center">
<cfinput type="submit" name="Login" value="Login" onClick="">
<cfinput type="submit" name="Cancel" value="Cancel" onClick="">
</div></th>
</tr>
</table>
</cfform>
<cfif isdefined("Form.Login")>
<cfquery name="Checkout" datasource="CFM" maxrows="1">
Select Log_name,Log_pass from dbo.Login where Log_name='#form.Login#'
</cfquery>
<cfif checkout.recordcount NEQ 0 >
<cfif #Log_name# eq #form.Login# and #Log_pass# eq #form.password#>
<a href="Home.cfm"></a>
<cfelse>
<cfoutput> Enter Valid Username or Password</cfoutput>
</cfif>
</cfif>
</cfif>
<!--- Check to see if the session variable exists,if not set it.--->
<cfparam name="session.IsLoggedIn" default="N"/>
<!---Check to see if the session variable exists,if not redirect them to the login page--->
<cfif IsDefined("session.IsLoggedIn") EQUAL "N0">
<cflocation url="/login.cfm"/>
</cfif>
Help as eaerly as possible.
