Expand my Community achievements bar.

How to use the submit email button to email files attached to a form

Avatar

Level 2

Hi,

I have a dynamic xml form that allows you to upload attachments into a sub form.

I have included a "Submit by Email" button, when clicked this button just sends the xml of the form.

How do I get it so that, this "Submit by Email" button creates and email with the xml AND the form attachments, all as attachments on the email??

Thanks for your time.

Here is the xml source for the attachment section for you to paste in.

<?xml version="1.0" encoding="UTF-8"?>
<?xfa generator="AdobeLiveCycleDesignerES_V9.0.0.0.20091029.1.612548" APIVersion="3.1.9277.0"?>
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/
" timeStamp="2010-05-11T13:49:16Z" uuid="73522e0a-4857-4684-9f73-0a3259861c47">
<template xmlns="http://www.xfa.org/schema/xfa-template/2.6/">
   <?formServer defaultPDFRenderFormat acrobat8.1static?>
   <subform name="form1" layout="tb" locale="en_US">
      <pageSet>
         <pageArea name="Page1" id="Page1">
            <contentArea x="6.35mm" y="3.175mm" w="107.95mm" h="41.275mm"/>
            <medium stock="letter" short="8.5in" long="11in"/>
            <?templateDesigner expand 1?></pageArea>
         <?templateDesigner expand 1?></pageSet>
      <subform w="4.25in" h="41.275mm">
         <field name="AddAttachment" y="3.175mm" x="3.175mm" w="28.575mm" h="9.525mm">
            <ui>
               <button/>
            </ui>
            <font typeface="Myriad Pro"/>
            <caption>
               <value>
                  <text>Add Attachment</text>
               </value>
               <para vAlign="middle" hAlign="center"/>
            </caption>
            <border hand="right">
               <?templateDesigner StyleID apbx2?>
               <edge stroke="raised"/>
               <fill>
                  <color value="212,208,200"/>
               </fill>
            </border>
            <bind match="none"/>
            <event activity="click" name="event__click">
               <script contentType="application/x-javascript">var oObj = event.target;
var fileAttachments = oObj.dataObjects;
if(attachmentsList.length &gt; 0)
{
 
  oObj.importDataObject(fileAttachments.length);
  var oDataObj = oObj.getDataObject(fileAttachments.length);
  attachmentsList.addItem(oDataObj.path);
  console.println("The attachments size is...."+fileAttachments.length);
  NoOfAttachments.rawValue = fileAttachments.length+1;

 
}
else
{
  oObj.importDataObject(counter.value);
  var oDataObj = oObj.getDataObject(counter.value);
  attachmentsList.addItem(oDataObj.path);
  NoOfAttachments.rawValue = 1;

}

</script>
            </event>
         </field>
         <field name="ViewAttachment" y="15.875mm" x="3.175mm" w="28.575mm" h="9.525mm">
            <ui>
               <button/>
            </ui>
            <font typeface="Myriad Pro"/>
            <caption>
               <value>
                  <text>View  Selected Attachment</text>
               </value>
               <para vAlign="middle" hAlign="center"/>
            </caption>
            <border hand="right">
               <?templateDesigner StyleID apbx2?>
               <edge stroke="raised"/>
               <fill>
                  <color value="212,208,200"/>
               </fill>
            </border>
            <bind match="none"/>
            <event activity="click" name="event__click">
               <script contentType="application/x-javascript">var oObj = event.target;
var sAttachObjName = attachmentsList.selectedIndex;
app.alert(attachmentsList.selectedIndex);
oObj.exportDataObject({ cName: sAttachObjName, nLaunch: 2 });

</script>
            </event>
         </field>
         <field name="attachmentsList" y="3.175mm" x="34.925mm" w="69.85mm" h="34.925mm">
            <ui>
               <choiceList open="always" commitOn="exit">
                  <border>
                     <?templateDesigner StyleID aped3?>
                     <edge stroke="lowered"/>
                  </border>
                  <margin/>
               </choiceList>
            </ui>
            <font typeface="Myriad Pro"/>
            <margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/>
            <caption placement="top" reserve="5mm">
               <para vAlign="middle"/>
               <value>
                  <text>List Of Attachments</text>
               </value>
            </caption>
         </field>
         <field name="Button1" y="28.575mm" x="3.175mm" w="28.575mm" h="9.525mm">
            <ui>
               <button/>
            </ui>
            <font typeface="Myriad Pro"/>
            <caption>
               <value>
                  <text>Remove  Selected Attachment</text>
               </value>
               <para vAlign="middle" hAlign="center"/>
            </caption>
            <border hand="right">
               <?templateDesigner StyleID apbx2?>
               <edge stroke="raised"/>
               <fill>
                  <color value="212,208,200"/>
               </fill>
            </border>
            <bind match="none"/>
            <event activity="click" name="event__click">
               <script contentType="application/x-javascript">var oObj = event.target;
oObj.removeDataObject(attachmentsList.selectedIndex);
attachmentsList.deleteItem(attachmentsList.selectedIndex);
</script>
            </event>
         </field>
         <?templateDesigner expand 1?></subform>
      <variables>
         <script contentType="application/x-javascript" name="soAttachments">function incrementCounter()
{

}
function checkForAttachment()
{

}

</script>
         <text name="counter">0</text>
         <?templateDesigner expand 1?></variables>
      <proto/>
      <desc>
         <text name="version">8.2.1.3144.1.471865.466429</text>
      </desc>
      <?templateDesigner expand 1?>
      <?templateDesigner isFragment yes?>
      <?templateDesigner fragmentTitle Attachment?></subform>
   <?templateDesigner SaveTaggedPDF 1?>
   <?templateDesigner SavePDFWithEmbeddedFonts 1?>
   <?templateDesigner SavePDFWithLog 0?>
   <?templateDesigner FormTargetVersion 26?>
   <?templateDesigner Zoom 101?>
   <?templateDesigner Rulers horizontal:1, vertical:1, guidelines:1, crosshairs:0?></template>
<config xmlns="http://www.xfa.org/schema/xci/2.6/
">
   <agent name="designer">
      <!--  [0..n]  -->
      <destination>pdf</destination>
      <pdf>
         <!--  [0..n]  -->
         <fontInfo/>
      </pdf>
   </agent>
   <present>
      <!--  [0..n]  -->
      <pdf>
         <!--  [0..n]  -->
         <version>1.7</version>
         <adobeExtensionLevel>1</adobeExtensionLevel>
      </pdf>
      <xdp>
         <packets>*</packets>
      </xdp>
      <common/>
      <script>
         <runScripts>server</runScripts>
      </script>
      <output/>
   </present>
</config>
<localeSet xmlns="http://www.xfa.org/schema/xfa-locale-set/2.6/">
   <locale name="en_US" desc="English (United States)">
      <calendarSymbols name="gregorian">
         <monthNames>
            <month>January</month>
            <month>February</month>
            <month>March</month>
            <month>April</month>
            <month>May</month>
            <month>June</month>
            <month>July</month>
            <month>August</month>
            <month>September</month>
            <month>October</month>
            <month>November</month>
            <month>December</month>
         </monthNames>
         <monthNames abbr="1">
            <month>Jan</month>
            <month>Feb</month>
            <month>Mar</month>
            <month>Apr</month>
            <month>May</month>
            <month>Jun</month>
            <month>Jul</month>
            <month>Aug</month>
            <month>Sep</month>
            <month>Oct</month>
            <month>Nov</month>
            <month>Dec</month>
         </monthNames>
         <dayNames>
            <day>Sunday</day>
            <day>Monday</day>
            <day>Tuesday</day>
            <day>Wednesday</day>
            <day>Thursday</day>
            <day>Friday</day>
            <day>Saturday</day>
         </dayNames>
         <dayNames abbr="1">
            <day>Sun</day>
            <day>Mon</day>
            <day>Tue</day>
            <day>Wed</day>
            <day>Thu</day>
            <day>Fri</day>
            <day>Sat</day>
         </dayNames>
         <meridiemNames>
            <meridiem>AM</meridiem>
            <meridiem>PM</meridiem>
         </meridiemNames>
         <eraNames>
            <era>BC</era>
            <era>AD</era>
         </eraNames>
      </calendarSymbols>
      <datePatterns>
         <datePattern name="full">EEEE, MMMM D, YYYY</datePattern>
         <datePattern name="long">MMMM D, YYYY</datePattern>
         <datePattern name="med">MMM D, YYYY</datePattern>
         <datePattern name="short">M/D/YY</datePattern>
      </datePatterns>
      <timePatterns>
         <timePattern name="full">h:MM:SS A Z</timePattern>
         <timePattern name="long">h:MM:SS A Z</timePattern>
         <timePattern name="med">h:MM:SS A</timePattern>
         <timePattern name="short">h:MM A</timePattern>
      </timePatterns>
      <dateTimeSymbols>GyMdkHmsSEDFwWahKzZ</dateTimeSymbols>
      <numberPatterns>
         <numberPattern name="numeric">z,zz9.zzz</numberPattern>
         <numberPattern name="currency">$z,zz9.99|($z,zz9.99)</numberPattern>
         <numberPattern name="percent">z,zz9%</numberPattern>
      </numberPatterns>
      <numberSymbols>
         <numberSymbol name="decimal">.</numberSymbol>
         <numberSymbol name="grouping">,</numberSymbol>
         <numberSymbol name="percent">%</numberSymbol>
         <numberSymbol name="minus">-</numberSymbol>
         <numberSymbol name="zero">0</numberSymbol>
      </numberSymbols>
      <currencySymbols>
         <currencySymbol name="symbol">$</currencySymbol>
         <currencySymbol name="isoname">USD</currencySymbol>
         <currencySymbol name="decimal">.</currencySymbol>
      </currencySymbols>
      <typefaces>
         <typeface name="Myriad Pro"/>
         <typeface name="Minion Pro"/>
         <typeface name="Courier Std"/>
         <typeface name="Adobe Pi Std"/>
         <typeface name="Adobe Hebrew"/>
         <typeface name="Adobe Arabic"/>
         <typeface name="Adobe Thai"/>
         <typeface name="Kozuka Gothic Pro-VI M"/>
         <typeface name="Kozuka Mincho Pro-VI R"/>
         <typeface name="Adobe Ming Std L"/>
         <typeface name="Adobe Song Std L"/>
         <typeface name="Adobe Myungjo Std M"/>
      </typefaces>
   </locale>
</localeSet>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.1-c043 52.398682, 2009/08/10-13:00:47        ">
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
         <xmp:MetadataDate>2010-05-11T13:49:16Z</xmp:MetadataDate>
         <xmp:CreatorTool>Adobe LiveCycle Designer ES 9.0</xmp:CreatorTool>
         <xmp:ModifyDate>2010-05-11T14:36:10+01:00</xmp:ModifyDate>
         <xmp:CreateDate>2010-05-11T14:36:10+01:00</xmp:CreateDate>
      </rdf:Description>
      <rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
         <pdf:Producer>Adobe LiveCycle Designer ES 9.0</pdf:Producer>
      </rdf:Description>
      <rdf:Description xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" rdf:about="">
         <xmpMM:DocumentID>uuid:73522e0a-4857-4684-9f73-0a3259861c47</xmpMM:DocumentID>
         <xmpMM:InstanceID>uuid:12c4f958-26b4-4cea-b9a1-18f64ed9bd79</xmpMM:InstanceID>
      </rdf:Description>
      <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
         <dc:format>application/pdf</dc:format>
      </rdf:Description>
      <rdf:Description xmlns:desc="http://ns.adobe.com/xfa/promoted-desc/" rdf:about="">
         <desc:version rdf:parseType="Resource">
            <rdf:value>8.2.1.3144.1.471865.466429</rdf:value>
            <desc:ref>/template/subform[1]</desc:ref>
         </desc:version>
      </rdf:Description>
      <rdf:Description xmlns:lcd="http://ns.adobe.com/livecycle/designer/" xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
         <lcd:fragmentCatalog>
            <rdf:Seq>
               <rdf:li rdf:parseType="Resource">
                  <dc:title>
                     <rdf:Alt>
                        <rdf:li xml:lang="x-default">Attachment</rdf:li>
                     </rdf:Alt>
                  </dc:title>
                  <dc:description>
                     <rdf:Alt>
                        <rdf:li xml:lang="x-default"/>
                     </rdf:Alt>
                  </dc:description>
                  <dc:identifier>$template.form1</dc:identifier>
                  <lcd:fragmentRole>Subform</lcd:fragmentRole>
               </rdf:li>
            </rdf:Seq>
         </lcd:fragmentCatalog>
      </rdf:Description>
   </rdf:RDF>
</x:xmpmeta>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
   <annots/>
</xfdf></xdp:xdp>

0 Replies