You also have to include a return in your onSubmit function, like this: <FORM name="myform" action="mypage.cfm" onsubmit="return validCCForm(this.form.ccType,this.form.ccNum);">
Christian On Thursday, March 13, 2003, at 10:55 PM, Joshua Miller wrote: > If you don't put the function into your <FORM> tag then it will return > false, but still submit. > > <FORM name="myform" action="mypage.cfm" > onsubmit="validCCForm(this.form.ccType,this.form.ccNum);"> > > Joshua Miller > Head Programmer / IT Manager > Garrison Enterprises Inc. > www.garrisonenterprises.net > [EMAIL PROTECTED] > (704) 569-9044 ext. 254 > > *********************************************************************** > * > ************* > Any views expressed in this message are those of the individual sender, > except where the sender states them to be the views of > Garrison Enterprises Inc. > > This e-mail is intended only for the individual or entity to which it > is > addressed and contains information that is private and confidential. If > you are not the intended recipient you are hereby notified that any > dissemination, distribution or copying is strictly prohibited. If you > have received this e-mail in error please delete it immediately and > advise us by return e-mail to [EMAIL PROTECTED] > *********************************************************************** > * > ************* > > > -----Original Message----- > From: Owens, Howard [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 13, 2003 9:11 PM > To: CF-Talk > Subject: OT: Javascript -- why is this form submitting? > > > > > I found this pretty nice cc validation script out on the net ... but I > had to make some modifications to it. > > I'm having a weird problem with it, however. > > Here is the relevant function: > > function validCCForm(ccTypeField,ccNumField) > { > > var result = > isValidCreditCardNumber(ccNumField,ccTypeField.value,"Credit Card > Number",true); > > if (result == true){ > return true; > } > else { > return false; > } > > The final function of a rather complex script. > > Now to my way of thinking, if it returns false, it means the script > isn't valid; in fact the proper alert pops up. But then the form > submits anyway. > > Now I thought if a return was false, the form wouldn't submit. But > this > keeps submitting. > > Here's the event handler: > > onClick="validCCForm(this.form.ccType,this.form.ccNum);" > > If you need to see the whole script, let me know and I'll send it to > you > directly. > > H. > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Howard Owens > Internet Operations Coordinator > InsideVC.com/Ventura County Star > [EMAIL PROTECTED] > AIM: GoCatGo1956 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4