Thank you in advance for any help. I am new to infopath and do not know very much about Jscript. This is what I have. I have a form with several fields that I would like to base my subject on when submitted.
I do think I have an issue wih my name space...
the fields I have are: Day, Shift, and Date
Day is a dropdown menu with Monday - Sunday
Shift is a drop down menu with the following...
Display Value
1st Shift 5AM - 12PM PST
2nd Shift 12PM - 7PM PST
3rd Shift 7PM - 5AM PST
Saturday 5AM - 5AM PST
Sunday 5AM - 5AM PST
Holiday 5AM - 5AM PST
And the last a date picker field formated as mm/dd/yy
Based on the Shift and day selected I need to have the Subject of the email formated in the following standard
Examples 1st shift weekday & a weekend or holiday
Shift Turnover - Monday mm/dd/yy 5AM - 12PM PST
Shift Turnover - Saturday mm/dd/yy 5AM - Sunday mm/dd/yy 5AM
I would prefer not use managed code as I do no know how to inlcluded the form in the body of the email any aother way than I am doing now... Here is what I have so far from the MSE... I also think I might have a problem with my namespace...
/*
* This file contains functions for data validation and form-level events.
* Because the functions are referenced in the form definition (.xsf) file,
* it is recommended that you do not modify the name of the function,
* or the name and number of arguments.
*
*/
// The following line is created by Microsoft Office InfoPath to define the prefixes
// for all the known namespaces in the main XML data file.
// Any modification to the form files made outside of InfoPath
// will not be automatically updated.
//<namespacesDefinition>
XDocument.DOM.setProperty("SelectionNamespaces", 'xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-22T21:08:17"');
//</namespacesDefinition>
//=======
// 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 SubmitBtn::OnClick(eventObj)
{
createEmail() // Calls email function
}
function createEmail() //creates email
{
//var xmlShift = XDocument.DOM.selectSingleNode("//my:TurnOver/my:ShiftInfo/my:Shift");
//var xmlDate = XDocument.DOM.selectSingleNode("/my:TurnOver/my:ShiftInfo/my:TodaysDate");
//var xmlDay = XDocument.DOM.selectSingleNode("/my:TurnOver/my:ShiftInfo/my:Day");
try
{
var oEnvelope = XDocument.View.Window.MailEnvelope;
oEnvelope.To = ("
[email protected];");
oEnvelope.Subject = ("Shift Turnover - ")
oEnvelope.Visible = true;
}
catch (ex)
{
XDocument.UI.Alert(ex.description);
}
}