It took me a while to comprehend your answer since the callback function is a 
javascript function no less than the one invoked via ajaxOnLoad, and both run 
on the client side. But now I think I get it: ajaxOnLoad means exactly what it 
says, namely that the function should execute as soon as the page *loads*; I've 
been treating it as though it meant 'as soon as the Coldfusion code in the page 
runs', and in fact, since everything in my saveGenInfo.cfm page (except for the 
ajaxOnLoad statement itself) consists of <cfquery> statements, there was 
nothing loaded into the client, so ajaxOnLoad had no reason to execute, which 
explains why it did not, in fact, execute.

What I'm doing with the ajaxOnLoad function which does work is: my 
populateWhatever.cfm pages (where Whatever is some the name of some SQL Server 
table) run CF code which builds an HTML table on the page, and fills one of its 
cells with the results of a <cfoutput query=whatvever> statement. But when the 
query returns no records, a blank form is stuffed into the table cell via the 
code: <cfif whatever.RecordCount eq 0><cfset 
ajaxOnLoad("Insert-blank-form")></cfif>, where Insert-blank-form (not its real 
name, of course) fills the cell via innerHTML=. So in this case, something did 
get loaded to the page, and that's why it works as expected, i.e., it works 
AFTER the load occurs, which is what you need with Ajax, according to Ben 
Forta's CF8 book Volume 2, bottom of p. 353, where he states that 'when a page 
is made up of multiple forms, it is more difficult to know when a page is 
really done'. 

Thanking you again,
Peyton


-----Original Message-----
>From: Mischa Uppelschoten ext 10 <[EMAIL PROTECTED]>
>Sent: Jan 15, 2008 4:38 PM
>To: Web Site <discussion@acfug.org>
>Subject: re[2]: [ACFUG Discuss] Ajax.submitForm Conundrum
>
>Glad that worked! I'm not sure about the exact answer to your questions but I 
>can only theorize that:
>
>1. You're not supposed to call the defined callback function yourself... the 
>YUI/ExtJS code will do that for you. I'm guessing that is because you will not 
>be exactly sure when the server is done processing, so you won't know when it 
>is safe to call the function.
>2. AjaxOnLoad is really meant to kick off a javascript function. Which is 
>client side. Which an action page doesn't really have anything to do with. 
>
>I think by putting ajax like functionality on your action page, you're making 
>it too hard for yourself ;-)
>/m
>
>
>: 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
>: -------------------------------------------------------------
>
>
>
>
>
>
>
>
>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 16:10:35 -0500 (GMT-05:00)
>
>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
-------------------------------------------------------------



Reply via email to