Are you sure you've got the fields 'revision' and 'EditComments' in your
form, with the same-case spelling?

Your bit of script chkRevision should ideally be in the <head> of your
document, not just above the form.




                                                                                       
                                       
                    "Rich Wild"                                                        
                                       
                    <[EMAIL PROTECTED]        To:     <[EMAIL PROTECTED]>              
                       
                    group.com>                      cc:                                
                                       
                                                    Subject:     [ cf-dev ] cfform     
                                       
                    29/06/2004 14:47                                                   
                                       
                    Please respond to dev                                              
                                       
                                                                                       
                                       
                                                                                       
                                       



Yuck. I've inherited code which I'm debugging and it all uses cfform, a
personal peeve of mine.

Now, perhaps its because I came back from Glastonbury yesterday and so am a
little bit mental, but I'm trying to get this cfform to fire off a
validation script on submit.

So I've added the onsubmit parameter to the cfform call like thus:

<cfform action="index.cfm?fuseaction=act_itemsteps&step=1" method="POST"
name="itemFrm" enctype="multipart/form-data" onsubmit="return chkRevision
();">

And I have the following function declared just above it like thus:

<script>
function chkRevision() {
                        if (document.itemFrm.revision.value &&
!document.itemFrm.EditComments.value.length) {
                                    alert('Warning!\n\nPlease ensure that
you have completed the \'Edit Comments\' field.');
                                    return false
                        } else {
                                    return true
                        }
            }
</script>

That should work yea? So why does the JS give me a Object Not Found error
when run at the browser on this line (which is obviously created by cfform)

function  _CF_checkitemFrm(_CF_this)
{
            if  (!_CF_hasValue(_CF_this.title, "TEXT" ))
            {
                        if  (!_CF_onError(_CF_this, _CF_this.title,
_CF_this.title.value, "Please enter Title"))
                        {
                                    return false;
                        }
            }
return chkRevision();

            return true;
}

p.s. I *would* dearly love to turn the whole form into a normal form, but
there's a lot of work required (large form) to do that and this is a quick
fix, very unfortunately.

I think I've left my mind in a field.

Ta everyone.

Rich




--
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]

Reply via email to