Re: Form Validation Issue using cfinput AND jquery
cf forms CAN validate cfselect boxes - you just have to code them properly: the default/invalid option MUST have its value set to a single space " " ( that is "[space]" ) a common mistake is to set the value to an empty string, which 'breaks' cf's built-in validation: any value other than a single space passes the validation. Azadi On 02/02/2011 01:02 , Kelly Matthews wrote: > Sorry if this ends up being a dupe post. > > I'm working on a client site that already had a CF Form in place using > cfinput and validation via required="yes" > > We added some select boxes that are required and as most of you know CF forms > don't really validate those. So, I am using jquery to validate the select > boxes when the form is submitted. > > The problem I am running into is this: The jquery portion works AND the CF > validation errors are thrown as well. But if I fill in all the selects that > are validated via jquery and do not to fill in the fields that are being > required via cfinput required="yes", the error is thrown but the form still > submits. Is this because of the jquery on submit validation? Has anyone run > into this before, is there an easy fix, outside of moving the cfinput > validation into the jquery validation? > > Kelly Matthews > Web Developer > http://www.cfwebtools.com > blog: http://kellymatthews.wordpress.com > Twitter: @webdiva > > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341811 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Form Validation Issue using cfinput AND jquery
I'm not sure that's correct. Using the same scenarios (and assuming the jquery validation is defined in onsubmit with return specified) here's my understanding: CFValidation = false - validation ends. > JQuery = doesn't get processed. > Form Doesn't Submit > > CFValidation = true > JQuery = false - validation ends > Form Doesn't Submit. > > CFValidation = false - validation ends. > JQuery = doesn't get processed. > Form Doesn't Submit. > > CFValidation = true > JQuery = true > *confetti* > > You either need to change your cfvalidation to be jquery, or build a > wrapper function for both validation that checks to make sure that both > validate before moving on. > I don't _think_ that's true. However I could be wrong. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341790 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Form Validation Issue using cfinput AND jquery
Is your JQuery validation returning false? Here is how I see it (I'm assuming here so don't shoot me)... CFValidation = false JQuery = true One result is true so it processes. CFValidation = true JQuery = false Same One result is true so it processes. CFValidation = false JQuery = false Both are false processing ends. CFValidation = true JQuery = true Both are true so it processes. You either need to change your cfvalidation to be jquery, or build a wrapper function for both validation that checks to make sure that both validate before moving on. Just a simple function that is, if CF or JQuery is false return false, if both true return true. Steve -Original Message- From: Michael Grant [mailto:mgr...@modus.bz] Sent: Tuesday, February 01, 2011 12:16 PM To: cf-talk Subject: Re: Form Validation Issue using cfinput AND jquery I generally try to roll my own validation and just use instead. You can much nicer validation. However with that being said I believe whatever you define in onSubmit="return bla" will only fire if the cf validation passes. Ray explains it here: http://www.coldfusionjedi.com/index.cfm/2008/1/11/Ask-a-Jedi-Mixing-cffo rm-validation-and-ajaxbased-functions On Tue, Feb 1, 2011 at 12:02 PM, Kelly Matthews wrote: > > Sorry if this ends up being a dupe post. > > I'm working on a client site that already had a CF Form in place using > cfinput and validation via required="yes" > > We added some select boxes that are required and as most of you know CF > forms don't really validate those. So, I am using jquery to validate the > select boxes when the form is submitted. > > The problem I am running into is this: The jquery portion works AND the CF > validation errors are thrown as well. But if I fill in all the selects that > are validated via jquery and do not to fill in the fields that are being > required via cfinput required="yes", the error is thrown but the form still > submits. Is this because of the jquery on submit validation? Has anyone > run into this before, is there an easy fix, outside of moving the cfinput > validation into the jquery validation? > > Kelly Matthews > Web Developer > http://www.cfwebtools.com > blog: http://kellymatthews.wordpress.com > Twitter: @webdiva > > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341789 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Form Validation Issue using cfinput AND jquery
I generally try to roll my own validation and just use instead. You can much nicer validation. However with that being said I believe whatever you define in onSubmit="return bla" will only fire if the cf validation passes. Ray explains it here: http://www.coldfusionjedi.com/index.cfm/2008/1/11/Ask-a-Jedi-Mixing-cfform-validation-and-ajaxbased-functions On Tue, Feb 1, 2011 at 12:02 PM, Kelly Matthews wrote: > > Sorry if this ends up being a dupe post. > > I'm working on a client site that already had a CF Form in place using > cfinput and validation via required="yes" > > We added some select boxes that are required and as most of you know CF > forms don't really validate those. So, I am using jquery to validate the > select boxes when the form is submitted. > > The problem I am running into is this: The jquery portion works AND the CF > validation errors are thrown as well. But if I fill in all the selects that > are validated via jquery and do not to fill in the fields that are being > required via cfinput required="yes", the error is thrown but the form still > submits. Is this because of the jquery on submit validation? Has anyone > run into this before, is there an easy fix, outside of moving the cfinput > validation into the jquery validation? > > Kelly Matthews > Web Developer > http://www.cfwebtools.com > blog: http://kellymatthews.wordpress.com > Twitter: @webdiva > > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341788 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm