No problem posting my code and providing a URL of it in action. The following 
is one of the many that I've tried which I believe to be syntactically correct. 
I left the JavaScript alert in so that you can see that it fires.

First one of the calling pages:

<cfinclude template="../AutoLogin.cfm"><!--- Goes to member home page if it 
logged someone in --->

<!--- Either no cookie, or no valid auto-login so just show the splash page --->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd";>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Whitevale Golf Club</title>
<link rel="stylesheet" media="all" type="text/css" href="../WGCStyle10.css" />
<script type="text/javascript">
function ChangeWidth()
{
var winW = 630;
if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape" || navigator.appName=="Opera") {
  winW = window.innerWidth;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth;
 }
}
document.images["image0"].width = winW;
}
</script>
</head>

<body OnLoad="ChangeWidth()" id="SplashBody">
<img id="image0" src="SplashHole4.jpg">
<div id="SplashLogo"><a href="PublicHome.cfm"><img SRC="SplashLogo.png" 
border="0"></a></div>
<div id="SplashButtons">
        <a href="PublicHome.cfm"><img SRC="../Buttons/LGuests.png" hspace="25" 
border="0"></a>
        <a 
href="javascript:ColdFusion.Window.show('Login');ColdFusion.navigate('../MemberLogin.cfm','Login');">
        <img SRC="../Buttons/LMembers.png" hspace="25" border="0"></a></div>
<cfinclude template="../LoginWindow.cfm">
</body>
</html>

Next the template "LoginWindow" which it calls:

<!--- The window used to display/process the member login --->
<cfwindow name="Login" modal="true" resizable="false" title="Please login" 
    width="380" height="200" x="80" y="80"
        bodyStyle="font-size:12px; font-family: verdana; background-color: 
##dcefd2; color: black; text-align: left;" 
    headerStyle="font-size:13px; font-weight:bold; font-family:Verdana; 
background-color: ##2e5327; color: white; text-align:left;" >
    <cfajaximport tags="cfform, cfwindow" scriptsrc="/CFIDE/scripts">
    </cfwindow> 


Next the entire template MemberLogin.cfm which it calls to process:

<cfset LoginMsg = True>
<cfif IsDefined("FORM.AccessID")>
        
        <!--- Processing for the form postback (user clicked on submit) --->
    <cfparam name="FORM.Remember" default="No">
    <cfquery name="GetUser" datasource="WGCClubUser">
            SELECT      UserName, FirstName, LastName, Password, 
GolfClassification, Sex, MemberID 
        FROM Users 
        WHERE Status = 'Active' AND UserName = '#FORM.AccessID#'
        </cfquery>
    <cfif (GetUser.RecordCount EQ 1) AND (FORM.Password EQ GetUser.Password)>
                <!--- Success: We have a member who has logged on successfully 
--->
                <!--- Create a user's extension record if one doesn't exist --->
        <cfquery name="GetExtCount" datasource="#datasource#">
            SELECT UserName
            FROM UserNameExt 
            WHERE UserName = '#FORM.AccessID#'
            </cfquery>
        <cfif GetExtCount.RecordCount EQ 0>
                <!--- Write a new blank one --->
            <cfquery name="GetExtCount" datasource="#datasource#">
                INSERT INTO UserNameExt(
                        UserName, 
                        LastLogin, 
                        AuthAdminEvents, 
                        AuthAdminContent, 
                        AuthAdminMarketing, 
                        AuthAdminUsers) 
                VALUES (#FORM.AccessID#, 
                                #01/01/2001#, 
                        0,0,0,0)
                </cfquery></cfif>
        <!--- We have a UserNameExt record, now update it with this login date 
--->
        <cfquery datasource="#datasource#">
            UPDATE UserNameExt
            SET LastLogin=#CreateODBCDateTime(Now())#
            WHERE UserName = '#FORM.AccessID#'
                        </cfquery>        
                <!--- Get the user's authorities --->
        <cfquery name="GetExt" datasource="#datasource#">
            SELECT *
            FROM UserNameExt 
            WHERE UserName = '#FORM.AccessID#'
            </cfquery>
        
        <!--- Remember stuff in the session variables --->
        <cflock timeout="5" throwontimeout="no" type="exclusive" 
scope="session"> 
                <cfset Session.IsLoggedIn=True>
                        <cfset Session.FirstName=GetUser.FirstName> 
                <cfset Session.LastName=GetUser.LastName> 
                <cfset Session.AccessID=GetUser.UserName> 
                <cfset Session.LoggedInAccessID=GetUser.UserName> 
                <cfset Session.Password=GetUser.Password> 
                <cfset Session.Class=GetUser.GolfClassification> 
                <cfset Session.Gender=GetUser.Sex> 
                <cfset Session.Account=GetUser.MemberID>
            <cfset Session.AuthAdminUsers=False> 
            <cfif GetExt.AuthAdminUsers EQ 1><cfset 
Session.AuthAdminUsers=True></cfif>
            <cfset Session.AuthAdminEvents=False> 
            <cfif GetExt.AuthAdminEvents EQ 1><cfset 
Session.AuthAdminEvents=True></cfif>
            <cfset Session.AuthAdminContent=False> 
            <cfif GetExt.AuthAdminContent EQ 1><cfset 
Session.AuthAdminContent=True></cfif>
            <cfset Session.AuthAdminMarketing=False> 
            <cfif GetExt.AuthAdminMarketing EQ 1><cfset 
Session.AuthAdminMarketing=True></cfif>
            </cflock> 

                <!--- Write back the values if remember was checked --->
        <cfif FORM.Remember EQ "Yes">
            <cfcookie name="WGCAccessID" value="#FORM.AccessID#" 
expires="Never">
            <cfcookie name="WGCPassword" value="#FORM.Password#" 
expires="Never">
        <cfelse>        <!--- or delete them if previously set --->
            <cfcookie name="WGCAccessID" value="" expires="Now">
            <cfcookie name="WGCPassword" value="" expires="Now">
            </cfif>
    
        <!--- Close window, go to Member home page --->
        <script language="JavaScript" type="text/javascript">
            ColdFusion.Window.hide('Login');
            location.href='../Members/MemberHome.cfm'; 
            </script>
        </cfif>

        <!--- Login Failure: Invalid AccessID or password --->
    <cfset LoginMsg = False>
    </cfif>

<!--- Set up the login box fields --->
<cfparam name="DefAccessID" default="">
<cfparam name="DefPassword" default="">
<cfparam name="DefRemember" default="No">
<cfif IsDefined("COOKIE.WGCAccessID") AND IsDefined("COOKIE.WGCPassword")>
        <cfset DefAccessID = COOKIE.WGCAccessID>
        <cfset DefPassword = COOKIE.WGCPassword>
        <cfset DefRemember = "Yes">
        </cfif>

<!--- Show the form --->
<div id="LoginDiv">
<cfif LoginMsg>
        <p>Please identify yourself, then press &quot;Submit&quot;</p>
<cfelse>
        <p class="errormsg">Incorrect Access ID or Password. Please try 
again.</p></cfif>
<cfoutput>
<cfform name="LoginForm">
        <table id="LoginBox">
        <tr height="21">
                <td width="100"><b>Access ID</b></td>
                <td width="100"><cfinput name="AccessID" validate="range" 
range="1000,4999" value="#DefAccessID#" size="8"
                        required="yes" message="A valid Access ID is required" 
/></td>
                </tr>
        <tr height="21">
                <td><b>Password</b></td>
                <td><cfinput name="Password" type="password" 
value="#DefPassword#" size="8" required="Yes"
                        message="A password is required" /></td>
                </tr>
        <tr height="21">
                <td colspan="2"><span class="fineprint">Remember me on this 
computer</span>
                        <cfset checked=IIf(DefRemember EQ 
"Yes","'checked'","''")>
                        <input type="checkbox" name="Remember" value="Yes" 
#checked#></td>
                </tr>
        </table>
        <cfinput name="Submit" type="image" value="Submit" 
src="../Buttons/MSubmit.png"  />
 </cfform>
 <script>
alert ('here');
document.LoginForm.AccessID.focus();
</script>
 </cfoutput></div>

The URL of this in action is 
http://www2.whitevalegolfclub.com/Public/PublicHome.cfm

It seems to me that the key to this is the fact that the cfform is named 
LoginForm and the script is:

<script>
alert ('here');
document.LoginForm.AccessID.focus();
</script>

Hope that gives someone some insight!


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337580
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to