you're using the assignment statment in your compare.

if (theForm.elements(i).value = "1")

assigns "1" to theForm.elements(i).value.  it sould be

if (theForm.elements(i).value == "1")

notice the double ='s.

i should have noticed that earlier, sorry.  i hope it helps.  it IS late.
i've cc'd you on it in the hopes that it might help you out faster.

chris olive, cio
cresco technologies
[EMAIL PROTECTED]
http://www.crescotech.com



-----Original Message-----
From: Terri Stocke [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 25, 2000 8:26 PM
To: CF-Talk
Subject: RE: JavaScript "object expected" error


Thanks, Chris! That definitely fixed the errors...now...

The form itself is not validating. I.E., I am able to select a number of
fields to "registered" (represented by a 1) that exceeds the class
size...the action form still processes, even though the max has been
exceeded...
If this weren't a hot item right now and I weren't facing the prospect of
staying up all night with this, I would stick it out and figure it out
myself...but, I really need the sleep...;)

<cfoutput>
<script language="Javascript">
function validateForm(theForm){
var registeredCount = #registered.registered_count#;
        for (i=0;i<theForm.length;i++){
                if (left(theForm.elements(i).name, 11) ="status_name")
                        if (theForm.elements(i).value = "1")
                                registeredCount = registeredCount + 1;
                                }
        if (registeredCount > #classname.class_size#){
                alert('The maximum class size is " & #classname.class_size# & "."');
                return false;
                }
        return true;
        }
        </script>
        </cfoutput>


----Original Message Follows----
From: "Christopher Olive, CIO" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: CF-Talk <[EMAIL PROTECTED]>
Subject: RE: JavaScript "object expected" error
Date: Mon, 25 Sep 2000 20:03:08 -0400

you shoule have

function validateForm(theForm) {...

and reference all objects on this form as theform.elements(i)...

you're currently passing the form as a paramater ("return
validateForm(this)") but aren't using it in the function.

chris olive, cio
cresco technologies
[EMAIL PROTECTED]
http://www.crescotech.com



-----Original Message-----
From: Terri Stocke [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 25, 2000 7:33 PM
To: CF-Talk
Subject: OT: JavaScript "object expected" error


I'm deferring to the more experienced programmers on the list...

I am getting an "object expected" error with this javascript...can anyone
point out the problem?

TIA!

[snip]
<cfform onSubmit="return validateForm(this)"
action="admin_edit.cfm?classid=#classid#" name="adminchange" method="POST"
enablecab="Yes">
[snip]

<cfoutput>
<script language="Javascript">
function validateForm(){
var registeredCount = #registered.registered_count#;
        for (i=0;i<document.adminchange.length;i++){
                if (left(document.adminchange.elements(i).name, 11) ="status_name")
                        if (document.adminchange.elements(i).value = "1")
                                registeredCount = registeredCount + 1;
                                }
        if (registeredCount > #classname.class_size#){
                alert('The maximum class size is " & #classname.class_size# & "."');
                return false;
                }
        return true;
        }
        </script>
        </cfoutput>
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to