Wow, CF 4.5? That's the version I learned on--you're really old school! I'm not sure the best way to implement what json.cfc does without the cfc--or even without user defined functions which came around in version 5.0--but you can look at it and maybe just pull the functionality you need out of the cfc -- http://www.epiphantastic.com/cfjson/.
I don't know about that submitHandler function--as I said I'm new to jQuery and it doesn't look like what I've done in the past, but it may be another route to consider... My bike ride was great, thanks, as was 27 holes of golf today. How is one supposed to work during such beautiful spring weather?? -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rick Faircloth Sent: Tuesday, March 13, 2007 10:00 AM To: 'jQuery Discussion.' Subject: Re: [jQuery] Calling all CF'ers... et al... Hi, Paul... Enjoy your ride yesterday? Thanks for the example code... it's beginning to make some sense as I study it. However, there one key sticking point... I'm using CF 4.5, so I don't use .cfc's that you asked about when your referenced <cfoutput>#json.encode(st)#</cfoutput> and the json.cfc. Is there another method to pass the result back to the calling page? Can I use the same method I used in my previous attempt at validation the "submitHandler" function? (I guess that's what was responsible for sending the data to and from my MortgageCalucation.cfm page...) Here's that function... submitHandler:function(){ varParams={}; $("input:text").each(function(){ Params[$(this).attr("name")]=$(this).val(); }) $.post("Mortgage_Calculation.cfm",Params,function(data){ $("#Result").empty().append(data); }) } Rick -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Sent: Monday, March 12, 2007 11:26 PM To: 'jQuery Discussion.' Subject: Re: [jQuery] Calling all CF'ers... et al... Okay as promised Will, here's what I do. It's most certainly not the most efficient method, since it's my first go 'round, but it does what I ask it to. I've added a few comments inline for you. (After pasting in here I can't even tell what's going on--and I wrote it! Paste this into your editor to get a clearer view...) A) Here is a snippet of the original html. It simply presents a field/label. <div class="row" id="shipto_location"> <div class="required">Ship-to location:</div> <input type="text" maxlength="75"> <!--- these inputs are all autocomplete text fields ---> <img src="" width="14" height="14" class="ico"> <!--- call $(".row img").hide() on page load ---> </div> B) Here is the jQuery bit that binds a behavior to the blur event. In my case this comes from a Taconite response, but I think you'd need it in your document.ready() function for testing. $("#shipto_location input").blur(function (){ /* when the input within #shipto_location loses focus, pass the name of the input and the value of the customer name input to be validated */ validateField('shipto_location',$("#customer_name input").val()); }); C) As posted before, here is the validateField function called by part B above. function validateField(field, criteria){ /* change the src of the row's icon (in this example, #shipto_location img.ico) to the loading spinny */ $("#"+field+" img.ico").attr("src","/images/office/ico-loading.gif"); /* pass the name of the field to validate, the value of said field, and the value of an optional criteria (in this case, $("#customer_name input").val()) */ $.get("/gateway/validate.cfm?field="+field+"&value="+$("#"+field+" input").val()+"&criteria="+criteria, function(response){ /* evaluate the json response */ response = eval("("+response+")"); /* display the appropriate icon; showIcon can be called after either ajax or local validation */ showIcon(field,response.pass,response.msg); }); } D) Here's the relevant snippet from validate.cfm: <!--- the cfswitch expression is url.field ---> <cfcase value="shipto_location" delimiters="|"> <cfquery name="q" datasource="Yard"> select s.shipto_id from shipto_locations as s inner join customers as c on s.customer_id = c.customer_id where (s.shipto = <cfqueryparam value="#url.value#">) and (c.customer = <cfqueryparam value="#url.criteria#">) </cfquery> <cfif q.recordcount GT 0> <!--- The value of st["pass"] is set to false by default above the cfswitch block ---> <cfset st["pass"]=true> <cfelse> <cfset st["msg"]="'#url.value#' is not a valid #url.criteria# location."> </cfif> </cfcase> ... <!--- after the cfswitch expression, display the struct in json format (you have json.cfc, right?) ---> <cfoutput>#json.encode(st)#</cfoutput> _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/