These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Not a function?

rpeterson
Registered: Oct 7 2008
Posts: 72

Can anyone help me? What makes the Function not a function? I keep getting the message...

DocumentList.SetDocListBoxEntries is not a function
1:XFA:form1[0]:MainSubform[0]:SelectionSubform[0]:TopicsDropDown[0]:change
DocumentList.SetDocListBoxEntries is not a function
1:XFA:form1[0]:MainSubform[0]:SelectionSubform[0]:TopicsDropDown[0]:change

in the JavaScript Debugger when I preview the form. The script is below in its entirety. HELP!?! Please?

----- form1.MainSubform.SelectionSubform.#variables[0].DocumentList::DocumentList - (JavaScript, client)

var oDocumentsList = {
800-849 General: [["800 Unit Overview"], ["801 "], ["802 "], ["803 "], ["804 "], ["805 "], ["806 "], ["807 "], ["808 "]],
850-874 Screens: [["850 "], ["851 "], ["852 "]],
875-929 Confirmations: [["875 "], ["876 "], ["877 "], ["885 "], ["886 "], ["887 "]],
930-939 Radiometer: [["930 "], ["931 "], ["932 "]],
940-949 FAA: [["940 "], ["941 "]],
950-954 GC-Headspace: [["950 "], ["951 "]],
955-964 Collections Unit: [["955 "], ["956 "], ["957 "]],
965-999 Miscellaneous: [["965 "], ["966 "], ["967 "], ["968 "], ["969 "], ["970 "], ["971 "], ["972 "], ["973 "], ["974 "]]
};
new Function (SetDocListBoxEntries( )
{
DocListBox.clearItems( );
DocListBox.rawValue = null;

var aDocs = oDocumentsList[xfa.event.change];
if(aDocs && aDocs.length)
{
for(var i=0;i

rpeterson

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
When the syntax of the definition is wrong.

From LiveCycle Designer's "Scripting Reference":

"For example, create a script object called feedback that contains the following function:

function emptyCheck(oField) {

if ((oField.rawValue == null) || (oField.rawValue == "")) {
xfa.host.messageBox("You must input a value for this field.", "Error Message", 3);
}
}"

Note there is no "new" and both FormCalc and JavaScript are case sensitive.

George Kaiser

rpeterson
Registered: Oct 7 2008
Posts: 72
I believe I changed the script to be like your example, but I am still getting the error message that the 'function' is not a function. Here are my changes:
----- form1.MainSubform.SelectionSubform.#variables[0].DocumentList::DocumentList - (JavaScript, both)

var oDocuments = {
800-849 General: [["800 Unit Overview"], ["801 "], ["802 "], ["803 "], ["804 "], ["805 "], ["806 "], ["807 "], ["808 "]],
850-874 Screens: [["850 "], ["851 "], ["852 "]],
875-929 Confirmations: [["875 "], ["876 "], ["877 "], ["885 "], ["886 "], ["887 "]],
930-939 Radiometer: [["930 "], ["931 "], ["932 "]],
940-949 FAA: [["940 "], ["941 "]],
950-954 GC-Headspace: [["950 "], ["951 "]],
955-964 Collections Unit: [["955 "], ["956 "], ["957 "]],
965-999 Miscellaneous: [["965 "], ["966 "], ["967 "], ["968 "], ["969 "], ["970 "], ["971 "], ["972 "], ["973 "], ["974 "]]
};

function SetDocListBoxEntries( )
{
var aDocs = oDocuments[xfa.event.change];
if(aDocs && aDocs.length)
{
for(var i=0;i

rpeterson

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
When calling the function, you need to reference the script object in the form hierarchy.


DocumentList.SetDocListBoxEntries( );

George Kaiser

rpeterson
Registered: Oct 7 2008
Posts: 72
I tried this:

----- form1.MainSubform.SelectionSubform.TopicsDropDown::change: - (JavaScript, both) --------------

DocumentList.SetDocListBoxEntries( );

and got:

DocumentList.SetDocListBoxEntries() is not a function
1:XFA:form1[0]:MainSubform[0]:SelectionSubform[0]:TopicsDropDown[0]:change
DocumentList.SetDocListBoxEntries() is not a function
1:XFA:form1[0]:MainSubform[0]:SelectionSubform[0]:TopicsDropDown[0]:change

I just don't get it (argh!). What am I not seeing?

rpeterson