Submitting forms - InfoPath Dev
in

InfoPath Dev

Submitting forms

Last post 08-26-2005 12:19 AM by Patrick Halstead. 19 replies.
Page 1 of 2 (20 items) 1 2 Next >
Sort Posts: Previous Next
  • 04-22-2005 07:35 AM

    Submitting forms

    I'm new at this but I know there are 2 ways to submit a form:
    1. creating a data connection and a submit button (in this case, we can set who the recipient of the form is, and the subject. The form will be sent as an xml attachment)
    2. clicking file--> 'submit to email recipient' (in this case, users have to type in who the email will go to, and the subject. the form will be sumitted as part of the email body)

    The form I am creating will be sent externally to someone who does not have infopath so if I use the first method to submit the form, they will get an xml attachment and won't be able to read it properly. Is there a way to set up a data connection and have a submit button that send the form as the body of the form rather than an attachment???

    thanks for your help!!
  • 04-22-2005 10:15 AM In reply to

    1. Yes there is a way that we can give Form xml as an Email body. In this case also we need to create the Email dataconnection.
    To set the email body we need to write some code. Here is the code snippet that can be used

    EmailAdapter oEmail = (EmailAdapter)thisXDocument.DataAdapters["Email Submit"]; //Here we are getting the email connection reference.
    oEmail.Intro = thisXDocument.DOM.xml; //by doing this we are giving Form xml as E-mail body to the end user.
    oEmail.Submit();

    Note: Above code is in "C#".

    2. But in the First approach that you have specified user can view the xml by saving the attachment to the local system and open in a Notepad which is much better. Because if user has Infopath he can open it infopath if not he can open it in Notepad.

    Agni
    InfoPathDev India
  • 07-20-2005 05:07 PM In reply to

    Hey Agni,

    Considering the fact that I am a coding idiot, how would I use the above code in Infopath (Jscript)? Would this be inserted on the "onclick" event of a button?

    Thanks for the help, you guys are great!!!
  • 07-20-2005 06:28 PM In reply to

    Hi WCOTech, I'll let Agni respond with details but in general, you'll want to create a .NET project for InfoPath and - yes - insert them into the OnClick handler for the button.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 07-20-2005 10:27 PM In reply to

    Hi

    Here is the code in Jcript that you can have in OnClick eventof a button
    var oEmail = XDocument.DataAdapters("Email Submit");
    oEmail.To = "[email protected]";
    oEmail.CC = "[email protected]";
    oEmail.Subject = "subject"
    oEmail.Intro = XDocument.Dom.xml;
    oEmail.Submit();

    Agni
    InfoPath Dev India
  • 07-21-2005 02:00 PM In reply to

    Thanks Agni, I'll try that code today and let you know how it turned out.
  • 07-22-2005 03:06 PM In reply to

    Agni,

    When I inserted your code, I received an error that says that "XDocument.Dom.xml" is undefined. Any Ideas?
  • 07-22-2005 06:05 PM In reply to

    Are you using C# or JScript?

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 07-22-2005 11:02 PM In reply to

    Jscript
  • 07-23-2005 01:19 AM In reply to

    XDocument.DOM.xml

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 07-25-2005 04:02 PM In reply to

    Pat, I used "XDocument.DOM.xml" and now get an error that says, "XDocument.DOM.xml" is null or is not an object. Any thoughts?
  • 07-25-2005 11:09 PM In reply to

    WCO, I need more context. Can you paste in the entire file?

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 08-24-2005 04:32 AM In reply to

    • oguz
    • Not Ranked
    • Joined on 08-19-2005
    • Posts 18
    Hi I add the following code to my Jscript. But there is no effect. I add a data connection with name Email Submit and while adding, infopath force me to enter at least a mail address to "to" or "cc" or "bcc". there is no error message or anything else but it does not send the mail to "[email protected]". It send the mail to other mail address(the entered while adding data connection)with attachment and without form in the body.

    function CTRL239_2::OnClick(eventObj)
    {
    var oEmail = XDocument.DataAdapters("Email Submit");
    oEmail.To = "[email protected]";
    oEmail.Subject = "Subject";
    oEmail.Intro = XDocument.DOM.xml;
    oEmail.Submit();

    }
  • 08-24-2005 06:03 AM In reply to

    Hi,

    Is outlook installed on your computer and config with a good mail address?

    If you don't have outlook installed that will never work!

    I don't know if that work with outlook express!

    ++

    Thierry

    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 08-24-2005 10:52 PM In reply to

    • oguz
    • Not Ranked
    • Joined on 08-19-2005
    • Posts 18
    I have outlook. there is no problem with outlook. I think the problem may be in data connection or code.
Page 1 of 2 (20 items) 1 2 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.