Multiple Emails Based on Checkboxes - InfoPath Dev
in

InfoPath Dev

Multiple Emails Based on Checkboxes

Last post 11-19-2009 06:23 AM by Gannje. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 11-18-2009 02:19 PM

    • Gannje
    • Not Ranked
    • Joined on 11-18-2009
    • Posts 6

    Multiple Emails Based on Checkboxes

    I'm pretty new to Infopath, and programming. I am using IP 2007 and jscript. I have a form with 2 text boxes (text1, text2), 2 checkboxes (check1,check2) and a button (submitBtn).  I need to send the form to 1 or more vendors based on checkboxs selected by the user. I also need the intro paragraph to be unique per vendor, which is why I'm resorting to code. The problem I'm having is that when the submit button is pressed, email is sent to all vendors regardless what checkboxes are selected. Any help would be greatly appreciated. My code is below.

    Thanks,

    function submitBtn::OnClick(eventObj)
    {
     // Write your code here
    var e1;
    var e2;
    var uname;
    var objEmailAdapter;

    e1 = XDocument.DOM.selectSingleNode("/my:myFields/my:check1").text;
    e2 = XDocument.DOM.selectSingleNode("/my:myFields/my:check2").text;

    XDocument.DOM.selectSingleNode("/my:myFields/my:text1").text = e1 //verifies the checkbox value
    XDocument.DOM.selectSingleNode("/my:myFields/my:text2").text = e2 //verifies the checkbox value

    if (e1 = "true")
    {
     objEmailAdapter = XDocument.DataAdapters("Email 1");
     objEmailAdapter.To = "[email protected]";
     objEmailAdapter.Subject = "Status Report";
     objEmailAdapter.Intro = "Standard Intro Paragraph";
     objEmailAdapter.Submit();
    }

    if (e2 = "true")
    {
     objEmailAdapter = XDocument.DataAdapters("Email 1");
     objEmailAdapter.To = "[email protected]";
     objEmailAdapter.Subject = "Status Report2";
     objEmailAdapter.Intro = "Next Standard Intro Paragraph";
     objEmailAdapter.Submit();
    }

    }

  • 11-18-2009 11:24 PM In reply to

    Re: Multiple Emails Based on Checkboxes

    your comparison is wrong it should be like

    e1 == "true"

    e2 == "true"

    "==" not "="

    == is comparison operator

    = is assignment operator

     

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 11-19-2009 06:23 AM In reply to

    • Gannje
    • Not Ranked
    • Joined on 11-18-2009
    • Posts 6

    Re: Multiple Emails Based on Checkboxes

    Now I feel like an idiot... I swear I thought I had tried that...lol. It works, Thanks Qazi.

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