M
mcampbell
I have a form created in InfoPath. I have created a button that the users
can click to print the form. However, I wish to create an if statement that
if certain controls/fields are left blank that a window popup message screen
appears to alert the user to fill out the form completely. I have the button
working as far as just printing out the form. But I do not know how to do
the rest. I have never programmed with a script editor. I learned how to
create a button to print the document but that is as far as I can get.
The field on my form that if it is blank, the form does not need to print,
is field10.
At some point in time I will modify the button to do a print/save function
with the same stipulations, if field10 is blank then do not print or save but
to display an error message in a popup window for the user to know what is
wrong.
I may even add more fields later but for now field10 is the main field I am
concerned with.
Thanks for any help!
I am a one week old novice in using InfoPath and have never done scripting.
Here is the code from my button script:
/*
* 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-03-30T16:49:47"');
//</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 CTRL99_5::OnClick(eventObj)
{
// Write your code here
}
//=======
// 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 CTRL100_5::OnClick(eventObj)
{
XDocument.PrintOut(); // Write your code here
}
can click to print the form. However, I wish to create an if statement that
if certain controls/fields are left blank that a window popup message screen
appears to alert the user to fill out the form completely. I have the button
working as far as just printing out the form. But I do not know how to do
the rest. I have never programmed with a script editor. I learned how to
create a button to print the document but that is as far as I can get.
The field on my form that if it is blank, the form does not need to print,
is field10.
At some point in time I will modify the button to do a print/save function
with the same stipulations, if field10 is blank then do not print or save but
to display an error message in a popup window for the user to know what is
wrong.
I may even add more fields later but for now field10 is the main field I am
concerned with.
Thanks for any help!
I am a one week old novice in using InfoPath and have never done scripting.
Here is the code from my button script:
/*
* 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-03-30T16:49:47"');
//</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 CTRL99_5::OnClick(eventObj)
{
// Write your code here
}
//=======
// 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 CTRL100_5::OnClick(eventObj)
{
XDocument.PrintOut(); // Write your code here
}