need custom submit code sample/example - InfoPath Dev

InfoPath Dev

Use our Google Custom Search for best site search results.

need custom submit code sample/example

Last post 09-04-2009 09:06 PM by princevis. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 04-05-2009 08:17 AM

    need custom submit code sample/example

    I'm new to InfoPath.  Can someone post some sample code for submit.  My immediate interest is in code to handle email submission.

    Or is there a way to view the code associated with a normal submit button?  A normal submit button to an email address doesn't seem to generate any script code, or at least I couldn't find it in the Microsoft Script Editor.

    I've written custom code (attached to the onclick event for a button on the form) to validate user input in various fields.  It's working fine.  But if I can move that code over into custom code for a submit button I won't need two buttons on the form.  If the code finds any problems it will alert the user and stop; otherwise it will continue on and submit the data.

    Again, I need some examples of code that submits to email.

    Thanks in advance for any help.

  • 04-05-2009 08:39 AM In reply to

    Re: need custom submit code sample/example

    In JScript, you can invoke the main submit adapter with:


    I believe in VBScript it would be the same without the parentheses and semicolon.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 04-06-2009 12:14 PM In reply to

    Re: need custom submit code sample/example

    Thanks for your reply.

    XDocument.Submit presumes you've defined a data connection for submit , correct?

    As a test I created a simple form with an email submit button, then defined the data connection.  (By the way, such data connections aren't viewable as a data source, per se, are they?)

    I extracted the form files and looked in manifest.xsf, finding:

     <xsf:submit caption="Su&amp;bmit" disableMenuItem="no" onAfterSubmit="keepOpen" showStatusDialog="yes">
      <xsf:emailAdapter name="chris_email" submitAllowed="yes">
       <xsf:to value="christian.bahnsen@xxxx" valueType="literal"></xsf:to>
       <xsf:intro value="This message was created by a Microsoft Office InfoPath form. The form data may be included as an attachment."></xsf:intro>
       <xsf:attachmentFileName value="Form" valueType="literal"></xsf:attachmentFileName>

     Can these xsf properties be set programmatically?  This would give me the flexibility to define an adapter on the fly.

    If I define multiple xsf:emailAdapters, is there a way to specify which adapter to use?  This would give me the flexiblilty to choose from pre-defined adapters.

    Are XPathTypedValue and/or EmailSubmitConnection going to be of any help, or are they more oriented toward Visual Studio use rather than in InfoPath jscript or vbscript?

    Sorry to pepper you with so many questions.

  • 09-04-2009 09:06 PM In reply to

    Re: need custom submit code sample/example

    On button_click event,write this code.. 


    { this.Submit();


    place a hidden field in an infopath form that can be a check box,in properties of butto dialog box,change it's value to true. And write a SPD workflow to send an email when that value is send to true.

    I think u got my ponit..

    Vishal Srivastava
    Senior Software Engineer
    SDG Software Pvt Ltd
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.