Hello folks,
 
I am in need of some enlightenment here with an issue that has me
stumped. I have a from validation script that I use in several forms in
a small personnel editor I built. In one particular page this script is
not firing and I cannot for the life of me see why it's not. The one
thing that seems to somehow play a part in this scenario is a session
variable I set at login: SESSION.Auth.UserRole, this gets set to 1 or 2.
1 is a basic rights level, 2 is full rights. The only place I actually
use this is where I display a set of links to various functions within
the editor. Below is the basic set up for this:
 
<cfif SESSION.Auth.UserRole IS '2'>
Change my password <a
href="#self#?fuseaction=admin.changepassword">Change password
now.</a><br />
            Add a New Web Administrator <a
href="#self#?fuseaction=admin.showwebadminform">Add New</a> 
<a href="#self#?fuseaction=admin.showwebadmins">View All</a><br />
            Registered IP Addresses <a
href="#self#?fuseaction=admin.viewipaddresses">View in web</a> or <a
href="domis/admin/actGetIPXLS.cfm">as an Excel file</a>.<br />
            All Faculty Members <a
href="#self#?fuseaction=admin.addfaculty">Add New</a> <a
href="#self#?fuseaction=admin.getallfaculty">Edit/Delete</a><br />
            All Administative Staff <a
href="#self#?fuseaction=admin.addadminpersonnel">Add New</a> <a
href="#self#?fuseaction=admin.getalladministration">Edit/Delete</a><br
/>
            All Nursing Staff <a
href="#self#?fuseaction=admin.addnursing">Add New</a> <a
href="#self#?fuseaction=admin.getallnursing">Edit/Delete</a>
<cfelse>
             <span style="font-weight:bold">Faculty
Members</span>&nbsp;&nbsp;
             <a
href="#self#?fuseaction=admin.addfaculty&division=#SESSION.Auth.Division
#">Add New</a>&nbsp;&nbsp;
            <a
href="#self#?fuseaction=admin.getfaculty&division=#SESSION.Auth.Division
#">Edit/Delete</a> <br />
            <span style="font-weight:bold">Administrative
Personnel</span>&nbsp;&nbsp;
            <a
href="#self#?fuseaction=admin.addadminpersonnel&division=#SESSION.Auth.D
ivision#">Add New</a>&nbsp;&nbsp;
            <a
href="#self#?fuseaction=admin.getadminpersonnel&division=#SESSION.Auth.D
ivision#">Edit/Delete</a><br />
            <span style="font-weight:bold">Nursing
Staff</span>&nbsp;&nbsp;
            <a
href="#self#?fuseaction=admin.addnursing&division=#SESSION.Auth.Division
#">Add New</a>&nbsp;&nbsp;
            <a
href="#self#?fuseaction=admin.getnursing&division=#SESSION.Auth.Division
#">Edit/Delete</a><br />
</cfif>
 
The actions for addadminpersonnel and addnursing load the same form with
some conditional stuff for preloading the form if the action is "edit"
.... yada yada yada.
 
My script is in the head as shown below:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="content-type" content="application/xhtml+xml;
charset=utf-8" />
<title>Add Member</title>
  <script type=text/javascript>
            function validateForm() {
                        var allOk = true;
                        var errorString = "The following are required
fields:\n";
                        
                        // require first name
                        if (!document.addmember.First_Name.value) {
                                    allOk = false;
                                    errorString += "\n- First Name";
                        }
                        // require last name
                        if (!document.addmember.Last_Name.value) {
                                    allOk = false;
                                    errorString += "\n- Last Name";
                        }                       
                        
                        // require a division before processing the
request
                        if (!document.addmember.Division.selectedIndex >
0) {
                                    allOk = false;
                                    errorString += "\n- Division";
                        }
                        // validate their email
                        var validEmail =
/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
                        if
(!validEmail.test(document.addmember.Email.value)) {
                                    allOk = false;
                                    errorString += "\n- Email Address";
                        }                                               
                        if (!allOk)                       
                        {
                                    alert(errorString);
                                    return false;
                        } 
 
                        return allOk;
            }
</script>
</head>
<body>
<cfoutput>
 
Trimmed this down but I think you get the idea ...
<cfif IsDefined('fuseaction') AND fuseaction IS
'admin.editadminpersonnel'>
            <cfset First_Name = getpersonnel.First_Name />
<cfelseif  IsDefined('fuseaction') AND fuseaction IS
'admin.editnursing'>
            <cfset First_Name = getnurse.First_Name />       
<cfelse>
            <cfset First_Name = "" />
</cfif>
 
 
    <form action="#self#?fuseaction=#XFA.submitForm#" name="addmember"
method="post" onsubmit="return validateForm(this);">
            <input type="text" name="First_Name" size="30"
maxlength="75" value="#First_Name#" />
            <input type="submit" name="submit" value="#ButtonText#" />
This just blows past my validation script and can't see why as this same
script is working just fine setup in pretty much the same way, just a
much larger form. Like I mentioned before, the only thing that seems to
be related is SESSION.Auth.UserRole. Email me off list if needed.
 
TIA!
 
Bob Imperial
DOM-IS Web Developer
Department of Medicine
125 Macnider Hall, CB 7005
UNC at Chapel Hill Chapel Hill, NC 27599
Phone: (919) 843-6151
 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 by AdobeĀ®
Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. 
Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283426
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to