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();
}
}