Yep, it really worked this time. I provide my final solution here for the benefit of any other CF8 newbies who might not have had to deal with this yet:
One can presumably send whatever url parms one likes to the target page, but for now, I played it safe and combined my two parms into a delimited string (for example 'update~145') and sent only that one parm tacked onto the url after the '?' as follows, where (in case you're curious), action is either 'update' or 'insert' and '145' specifies the three jobtypes, 1, 4, and 5, which determine one callback behavior vs. another (this is for a court reporting company): ColdFusion.Ajax.submitForm('fmGenInfo','saveGenInfo.cfm?parmstring=' + action +'~'+ '145',GenInfoCallback); Then I pulled parmstring apart with ListGetAt inside the target page, and made use of the only parm I needed there (the value of action, which was 'update' in this case), and I ended the page as follows: <cfoutput>~#url.parmstring#</cfoutput> Notice the extra tilde, '~', in front of the url variable. This turned out to be necessary because the HTTP response (or anyway the parts of it which get sent to the callback function) includes not only the simple output I would have intended, but all the comments in my page. So it was necessary to get rid of them first, as follows: function GenInfoCallback(parmstring){ p=parmstring.indexOf('~'); // find where the comments in the HTTP response end parmstring = parmstring.substr(p+1); // get rid of them p=parmstring.indexOf('~'); // now find where the mode parm ends mode=parmstring.substring(0,p); // set that part to the mode variable typelist=parmstring.substr(p+1); // set the rest to the typelist variable ColdFusion.navigate('populateGenInfo.cfm','getGenInfo'); url = (typelist == '145') ? 'populateTx.cfm' : 'populateTkdnOrApp.cfm'; if (mode == 'insert'){ ColdFusion.navigate(url,'getTx'); ColdFusion.navigate(etc. - omitted here) } } This really is working now. But in addition to its ugliness, getting rid of the first part is worrisome. Who knows when some future programmer, if there is one, might put a tilde into a comment somewhere without knowing the consequences. I explain this in another comment, but... I seem to remember from my days as a CF5 programmer five years ago that there's a way to tell ColdFusion not to send the comments. Does anyone remember what that is? I scanned through the administrator and saw nothing promising, though I admit I didn't open every panel. But would that help anyway? There's also lots of white space in the HTTP response sent to the callback function (where all the <cfquery> statements were). My fuzzy memory says there's a way to get rid of that, too. Hopefully one could specify that on a page-by-page basis? Peyton -----Forwarded Message----- >From: Peyton Todd <[EMAIL PROTECTED]> >Sent: Jan 15, 2008 9:19 PM >To: discussion@ACFUG.org >Subject: [ACFUG Discuss] Ajax.submitForm Conundrum: The Saga Continues > >After running the example code in the livedocs, I think I understand how now >how callback is supposed to work: Yes, callback can have one parm, not >specified in the within the submitForm call, but rather passed to it by the >target page itself. I'm about to test my new understanding, but before I do, >I'm sending this quick message to save any of you from wasting time explaining >it to me if in fact I'm right that I've figured it out. > >Watch this space for further developments... > >-----Forwarded Message----- >>From: Peyton Todd <[EMAIL PROTECTED]> >>Sent: Jan 15, 2008 7:46 PM >>To: discussion@acfug.org >>Subject: [ACFUG Discuss] Ajax.submitForm Conundrum: Not Fixed After All >> >>A thousand apologies. I was mistaken when I said that specifying a single >>parm in the callback function as opposed to two parms solved the problem. My >>only excuse is I had been working on something else all day, and only turned >>half my attention to this. Turning back to this project this evening and >>testing more carefully, I find to my chagrin that specifying just one parm is >>no better than specifying two. Although the parm does get passed to the >>callback function, just as the two parms I was trying earlier got >>successfully passed, the form submission requested in the Ajax.submitForm >>function does not occur, for the reason that the browser thinks the form does >>not exist, which is false, as Verify Generated Source in Firebug can easily >>show. I get the same results in Internet Explorer, which tells me only >>'Exception thrown and not caught', i.e., the same message as Firefox, but >>without telling me what the exception was. >> >>What does work (and I tested this carefully - at least it has worked in the >>cases tested so far) is having a single callback functionname - WITHOUT >>PARAMETERS - passed in the third ('callback parameter') position in the >>submitForm call, thus: >> >>ColdFusion.Ajax.submitForm('fmGenInfo','saveGenInfo.cfm?mode='+action,GenInfoCallback); >> >>Not only does the form get submitted in this case (the data updates get >>saved) - which is further proof that the form really was in the page, despite >>the incorrect error message - but the callback function performs the >>behaviors I directed it to perform (but only because the 'parms' are >>expressly set by assignment statements inside it). >> >>Since there are four different callback behaviors required depending on the >>four combinations of my two parameters, I seem to have no other choice but to >>have four separate submitForm calls, each one specifying a different callback >>function. Tacky, but it will work. (Which are not famous last words, I hope!) >> >>Sorry for the mixup, >>Peyton >> >> >>-----Forwarded Message----- >>>From: Peyton Todd <[EMAIL PROTECTED]> >>>Sent: Jan 15, 2008 4:10 PM >>>To: discussion@acfug.org >>>Subject: re: [ACFUG Discuss] Ajax.submitForm Conundrum >>> >>>Many thanks. I tried your suggestion (i.e., I passed the string: action + >>>'~' + 145' as a single parm to the callback function and broke it apart >>>inside that function), and it worked beautifully! That is, both the database >>>update and the duties specified in the callback function were executed >>>correctly. >>> >>>However, before trying that I tried something else (since I was a little >>>leery of what asynchronous might mean in this case), and I'm curious to know >>>why that method did not succeed. Namely, I took the callback parm out of the >>>submitForm statement, and in its stead, I added the following line to the >>>bottom of the target form, saveGenInfo.cfm: <CFSET >>>ajaxOnLoad("GenInfoCallback(#url.mode#)")>, settling for a single parm for >>>now (value = either 'insert' or 'delete'), just to see if an alert statement >>>inside GenInfoCallback (misnamed now of course) would show that it got >>>called, and received the parm. But no luck. The update to SQL Server >>>succeeded but GenInfoCallback was never called. >>> >>>Why not? And in general, when would it be appropriate to use the callback >>>method vs. the ajaxOnLoad method? >>> >>>Thanks in advance, >>>Peyton >>> >>> >>>-----Original Message----- >>>>From: Mischa Uppelschoten ext 10 <[EMAIL PROTECTED]> >>>>Sent: Jan 15, 2008 3:08 PM >>>>To: Web Site <discussion@acfug.org> >>>>Subject: re: [ACFUG Discuss] Ajax.submitForm Conundrum >>>> >>>>AFAIK the action page you submit to in this case must return only a string >>>>and the callback function can only handle that one string. You can delimit >>>>the string and parse it though. >>>> >>>>From the docs: >>>>callbackhandler >>>>The JavaScript function to handle a normal response. The function must take >>>>a single argument, that contains the response body. This method is used >>>>only if the form submission is asynchronous. >>>> >>>> >>>>Hope that helps! >>>>/m >>>> >>>> >>>> >>>>: Hello all. Does anyone have a suggestion to make regarding the following >>>>: quandary I find myself in? >>>> >>>>: I'm trying to submit a form from inside a javascript function thus: >>>> >>>>: function SubmitFmGenInfo145(action){ >>>>: //form validation code (omitted here), then: >>>>: ColdFusion.Ajax.submitForm('fmGenInfo', 'saveGenInfo.cfm?mode=' + >>>>: action,GenInfoCallback(action,'145')); >>>>: } >>>> >>>>: When I do so, the callback function, shown below, executes correctly. It >>>>shows >>>>: by the alert statements that it received the parameters, and by the >>>>state of >>>>: the screen that it executed the populateGenInfo.cfm call (I haven't >>>>tested it >>>>: for inserting yet). However, the form does not get submitted, and Firebug >>>>: complains with the following error message: 'uncaught exception: >>>>: ColdFusion.Ajax.submitForm: Form not found, form id: fmGenInfo'. >>>> >>>>: function GenInfoCallback(mode,typegroup){ >>>>: alert(mode); alert(typegroup); >>>>: ColdFusion.navigate('populateGenInfo.cfm','getGenInfo'); >>>>: url = (typegroup == '145') ? 'populateTx.cfm' : 'populateTkdnOrApp.cfm'; >>>>: if (mode == 'insert'){ >>>>: ColdFusion.navigate(url,'getTx'); >>>>: ColdFusion.navigate('populateSpecInstr.cfm?mode=no','getSpecInstr'); >>>>: } >>>>: } >>>> >>>>: However, the form most definitely does exist in the page, as Firebug's >>>>View >>>>: Gererated Source makes clear. (Thank goodness Firebug has this ability; >>>>: otherwise I could never be completely certain what the <cfdiv> >>>>contains!) >>>> >>>>: Furthermore, when I do nothing but remove the reference to the callback >>>>: function, changing the submitting function to the form shown below, >>>>Firebug >>>>: does not complain, and the form submits flawlessly. >>>> >>>>: function SubmitFmGenInfo145(action){ >>>>: //form validation code (omitted here), then: >>>>: ColdFusion.Ajax.submitForm('fmGenInfo', 'saveGenInfo.cfm?mode=' + action); >>>>: } >>>> >>>>: What could be going on here? Is one not supposed to send parms to a >>>>callback >>>>: function? Or am I perhaps using the wrong syntax for doing so? >>>> >>>>: Thanks in advance for your ideas, >>>>: Peyton >>>> >>>> >>>> >>>>: ------------------------------------------------------------- >>>>: Annual Sponsor FigLeaf Software - http://www.figleaf.com >>>> >>>>: To unsubscribe from this list, manage your profile @ >>>>: http://www.acfug.org?fa=login.edituserform >>>> >>>>: For more info, see http://www.acfug.org/mailinglists >>>>: Archive @ http://www.mail-archive.com/discussion%40acfug.org/ >>>>: List hosted by http://www.fusionlink.com >>>>: ------------------------------------------------------------- >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>>Mischa Uppelschoten >>>>The Banker's Exchange, LLC. >>>>4200 Highlands Parkway SE >>>>Suite A >>>>Smyrna, GA 30082-5198 >>>> >>>>Phone: (404) 605-0100 ext. 10 >>>>Fax: (404) 355-7930 >>>>Web: www.BankersX.com >>>>Follow this link for Instant Web Chat: >>>>http://www.bankersx.com/Contact/chat.cfm?Queue=MUPPELSCHOTEN >>>>---------- Original Message ---------- >>>> >>>>FROM: Peyton Todd <[EMAIL PROTECTED]> >>>>TO: discussion@acfug.org >>>>DATE: Tue, 15 Jan 2008 14:30:04 -0500 (EST) >>>> >>>>SUBJECT: [ACFUG Discuss] Ajax.submitForm Conundrum >>>> >>>>Hello all. Does anyone have a suggestion to make regarding the following >>>>quandary I find myself in? >>>> >>>>I'm trying to submit a form from inside a javascript function thus: >>>> >>>>function SubmitFmGenInfo145(action){ >>>>//form validation code (omitted here), then: >>>>ColdFusion.Ajax.submitForm('fmGenInfo', 'saveGenInfo.cfm?mode=' + >>>> action,GenInfoCallback(action,'145')); >>>>} >>>> >>>>When I do so, the callback function, shown below, executes correctly. It >>>>shows by the alert statements that it received the parameters, and by the >>>>state of the screen that it executed the populateGenInfo.cfm call (I >>>>haven't tested it for inserting yet). However, the form does not get >>>>submitted, and Firebug complains with the following error message: >>>>'uncaught exception: ColdFusion.Ajax.submitForm: Form not found, form id: >>>>fmGenInfo'. >>>> >>>>function GenInfoCallback(mode,typegroup){ >>>>alert(mode); alert(typegroup); >>>>ColdFusion.navigate('populateGenInfo.cfm','getGenInfo'); >>>>url = (typegroup == '145') ? 'populateTx.cfm' : 'populateTkdnOrApp.cfm'; >>>>if (mode == 'insert'){ >>>> ColdFusion.navigate(url,'getTx'); >>>> ColdFusion.navigate('populateSpecInstr.cfm?mode=no','getSpecInstr'); >>>> } >>>>} >>>> >>>>However, the form most definitely does exist in the page, as Firebug's View >>>>Gererated Source makes clear. (Thank goodness Firebug has this ability; >>>>otherwise I could never be completely certain what the <cfdiv> contains!) >>>> >>>>Furthermore, when I do nothing but remove the reference to the callback >>>>function, changing the submitting function to the form shown below, Firebug >>>>does not complain, and the form submits flawlessly. >>>> >>>>function SubmitFmGenInfo145(action){ >>>>//form validation code (omitted here), then: >>>>ColdFusion.Ajax.submitForm('fmGenInfo', 'saveGenInfo.cfm?mode=' + action); >>>>} >>>> >>>>What could be going on here? Is one not supposed to send parms to a >>>>callback function? Or am I perhaps using the wrong syntax for doing so? >>>> >>>>Thanks in advance for your ideas, >>>>Peyton >>>> >>>> >>>> >>>>------------------------------------------------------------- >>>>Annual Sponsor FigLeaf Software - http://www.figleaf.com >>>> >>>>To unsubscribe from this list, manage your profile @ >>>>http://www.acfug.org?fa=login.edituserform >>>> >>>>For more info, see http://www.acfug.org/mailinglists >>>>Archive @ http://www.mail-archive.com/discussion%40acfug.org/ >>>>List hosted by http://www.fusionlink.com >>>>------------------------------------------------------------- >>>> >>>> >>>>------------------------------------------------------------- >>>>Annual Sponsor FigLeaf Software - http://www.figleaf.com >>>> >>>>To unsubscribe from this list, manage your profile @ >>>>http://www.acfug.org?fa=login.edituserform >>>> >>>>For more info, see http://www.acfug.org/mailinglists >>>>Archive @ http://www.mail-archive.com/discussion%40acfug.org/ >>>>List hosted by http://www.fusionlink.com >>>>------------------------------------------------------------- >>>> >>>> >>>> >>> >>> >>> >>>------------------------------------------------------------- >>>Annual Sponsor FigLeaf Software - http://www.figleaf.com >>> >>>To unsubscribe from this list, manage your profile @ >>>http://www.acfug.org?fa=login.edituserform >>> >>>For more info, see http://www.acfug.org/mailinglists >>>Archive @ http://www.mail-archive.com/discussion%40acfug.org/ >>>List hosted by http://www.fusionlink.com >>>------------------------------------------------------------- >>> >>> >>> >> >> >> >>------------------------------------------------------------- >>Annual Sponsor FigLeaf Software - http://www.figleaf.com >> >>To unsubscribe from this list, manage your profile @ >>http://www.acfug.org?fa=login.edituserform >> >>For more info, see http://www.acfug.org/mailinglists >>Archive @ http://www.mail-archive.com/discussion%40acfug.org/ >>List hosted by http://www.fusionlink.com >>------------------------------------------------------------- >> >> >> > > > >------------------------------------------------------------- >Annual Sponsor FigLeaf Software - http://www.figleaf.com > >To unsubscribe from this list, manage your profile @ >http://www.acfug.org?fa=login.edituserform > >For more info, see http://www.acfug.org/mailinglists >Archive @ http://www.mail-archive.com/discussion%40acfug.org/ >List hosted by http://www.fusionlink.com >------------------------------------------------------------- > > > ------------------------------------------------------------- Annual Sponsor FigLeaf Software - http://www.figleaf.com To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -------------------------------------------------------------