Email Submit and Form Code - InfoPath Dev
in

InfoPath Dev

Email Submit and Form Code

Last post 08-07-2008 12:32 PM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 08-07-2008 11:23 AM

    Email Submit and Form Code

    Not sure if I need to be here or in Data Connections....  Not a noob, but also not a programmer or developer at all - just a guy who makes forms with IP 2003.  I created a form that generates workorders that are sent to our trade partners.  The form has to buttons and two dorresponding data connections - one for submitting to the SP forms library and one to set a value in a field and then submit to email via the second data connection.  The second button is where the problem resides.  I have the porperties of this button set to 'rules and custom code' and I have applied two rules - the first one sets the value of a date field and the second submits to the data connection.  The data connection was set up with the wizard and I used a fx to retrieve the 'to' email address from a value in the form.  I need to have specific text in the 'introduction box', but the field in the wizard only allows a limited number of characters - not enough to satisfy my requirements.  I have scoured this forum (and others) and the bits of code that I was able to plagiarize did not work.  The examples that were provided did not resemble my form code.  What I found here always called the emailadapter and that object is not in my form code.  When I am in the button properties and I click 'edit form code' this is what I get:

    //======= //
    The following function handler is created by Microsoft Office InfoPath.
    // Do not modify the name of the function, or the name and number of arguments.
    //=======
    function CTRL50_5::OnClick(eventObj)
    {
                         // Write your code here
    }

    None of the snippets that I plugged into the 'write your code here' worked, but maybe that is because they were for the emailadapter and I have an onclick event?  Other than this one simple thing, the form works beautifully (believe it or not) and the information in the introduction field is purely for CYA - but necessary.  Any help that anyone can provide is greatly appreciated.

    Fishman

    Fishman
  • 08-07-2008 11:41 AM In reply to

    Re: Email Submit and Form Code

    Hi, and welcome!

    So, it appears that your form is set to use JScript as the programming language. Since you are using IP2003, you may have been running across code samples using the IP2007 object model with managed code, which could be part of the reason you are struggling.

    Here are some links that may help get you going in the right direction:

    http://www.infopathdev.com/forums/p/3446/22246.aspx
    http://blogs.msdn.com/infopath/archive/2004/08/17/216172.aspx
    http://msdn.microsoft.com/en-us/library/aa167754(office.11).aspx

    The first one suggest the Issue Tracking Sample form in IP2003 as a good source for sample code to use for customizing an email submit, so you may want to check that out as well.

    Hilary Stoupa

  • 08-07-2008 12:08 PM In reply to

    Re: Email Submit and Form Code

    Hello Hilary and thanks for the quick response!  I am afraid that I have already tried very similar approaches.  It seems as if the form is trying to create the email twice when I do something like this.  The email already works as it is, do I need to remove the rule from the button that causes it to submit and then try the examples you suggest?  Sorry to be so dim, but I just am not getting it.

     

    Fishman
  • 08-07-2008 12:32 PM In reply to

    Re: Email Submit and Form Code

    Okay, I think I may have an idea of your scenario. Your button is using a rule to submit the form using your email submit connection.... and you are calling code. So it is exactly what you are suggesting. Rules run before code in IP, so the submit rule runs, then any code you have attached to the button. Deselect the rule on your button (no need to delete right away, what if you change your mind and want it back?) and then go with the code instead....

    Hilary Stoupa

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.