0 Replies Latest reply on Jul 5, 2010 1:54 PM by browser1212

    Multiple cfform instances on page called by ajax Window.create

    browser1212

      In CF8 I populate a page with a list of buttons each of which causes the execution of this javascript function passing a unique emailNumber;

       

      function presentform(emailNumber)
        {

         jsEmail=emailNumber;
         jsParm= jsParmStart + jsEmail + "&userEmail=" + jsUserEmail + "&drid=" + jsDrid;
         alert(jsParm);
         ColdFusion.Window.create('forwardEmailWindow', 'Forward Email', jsParm,
                             {x:100,y:100,height:700,width:600,modal:true,closable:true,
                             draggable:true,resizable:true,center:true,initshow:true,
                             minheight:200,minwidth:200});

      }

       

      For each button click the alert shows me that a unique emailNumber is being sent for each button. However secondary form displays keep the emailNumber of the first clicked button (in the cfform in SUBJECT:  Forward of Acceptance Completion Email <cfoutput>#URL.emailId#</cfoutput>). The cfmail however works, sending the correct subject line ( subject = "Forward of Acceptance Completion Email #URL.emailId#" >  ).

      Is it is a issue with the way AJAX works ? That the form is only created on the first use/instantiation on the server ? Is there away to cause it to recreate or refresh a cfform ?

       

      Thanks

       

       

       

       

      forwardEmail.cfm :

       

      <cfajaximport tags="cftextarea">

      <cfinclude template="../include/conf.cfm">


       
      <body>

      <cfif IsDefined("URL.emailId") AND #URL.emailId# NEQ  "">
      <cfset current_email_id = #URL.emailId# >

       

      <cfdump var="#URL.emailId#">
        <cfdump var="#current_email_id#">
           <cfquery name="EmailInfo" datasource=#CRDB#>
               SELECT * FROM tblEmail WHERE EmailId = #URL.emailId#
           </cfquery>
        

        
           <cfif IsDefined("FORM.others_email") AND #FORM.others_email# NEQ  "">
              <cfset to_email = #FORM.others_email# >
              <cfset FORM.others_email = "">
              <cfif IsDefined("FORM.editArea") AND #FORM.editArea# NEQ  "">
                  <cfset forwarding_comments = #FORM.editArea# >
              </cfif>

                     <cfset todayDate = #Now()#>
               <cfset formattedDateTime = #DateFormat(todayDate, 'MM/DD/YYYY')# & ' ' & #TimeFormat(                                  todayDate, 'HH:MM:SS')#>
                     <cfquery datasource=#CRDB#>
                     INSERT INTO tblEmail
                       (intDrid, Email_subject, Created_date, Created_user, To_address, Cc_address, From_address,    Email_message)
                     VALUES
                       ('#EmailInfo.intDrid#',
                      
                        '#EmailInfo.Email_subject#',
                       
                         '#formattedDateTime#',
                        
                         '#CRDB_User#',
                        
                         '#to_email#',
                
                         '#CRDB_IT_OPS_TO_Email2#',
                        
                         '#CRDB_FROM_Email#',
                        
                          '#EmailInfo.Email_message# COMMENTS: #forwarding_comments#');
             
                    </cfquery>

              <cfmail to = "#to_email#"
                      from = "#CRDB_FROM_Email#"
                      failto="#URL.userEmail#"
                      subject = "Forward of Acceptance Completion Email #URL.emailId#" >      

      Email by #EmailInfo.Created_user#  on #EmailInfo.created_date#

      Subject: #EmailInfo.Email_subject#

      To: #EmailInfo.To_address#
           
      CC: #EmailInfo.CC_address#
            
      From: #EmailInfo.from_address#
         
      Message: #EmailInfo.Email_message#


      COMMENTS: #forwarding_comments#

              </cfmail>
        
           </cfif>
      <p>

      <cfform name = "forwardEmail" action = "forwardEmail.cfm" method="POST" preservedata="false" >
          <pre>
          SUBJECT:  Forward of Acceptance Completion Email <cfoutput>#URL.emailId#</cfoutput>
          <hr>
          MESSAGE:
          <textarea name ="body" cols="60" rows="15" wrap="virtual" readonly="readonly">
              <cfoutput query="EmailInfo">

      Email by #EmailInfo.Created_user#  on #EmailInfo.created_date#

      Subject: #EmailInfo.Email_subject#

      To: #EmailInfo.To_address#
           
      CC: #EmailInfo.CC_address#
            
      From: #EmailInfo.from_address#
         
      Message: #EmailInfo.Email_message#
            
          </cfoutput>
         
          </textarea>

          <cftextarea  name="editArea" basepath="/fckeditor" richText="false" cols="60" rows="10" >

          </cftextarea>
          </pre>
          <p>
             Forward to following email addresses separated by semicolons:</p>
          <p>
          <input type="text" name="others_email" size=75>
           <p>
          <p><cfinput type = "button" onclick="submitform()"       
              name = "" value = "Forward Email"></p>
          </p>

      </cfform>

      </cfif>
           
      </body>