Infopath & JScript error (Object: doesn't support this property or method)

S

stallwoe

Hey folks,
I am having a big problem on a application being pushed out
to a client. The Infopath form in question uses a ton of JScript
objects, getters, setters, etc... The error I'm encountering is:
"Object: doesn't support this property or method" This error occurs on
a small method that's not doing much but getting information from a
form using a getter and comparing it to a string value. Below is the
code:

//=============
//gets Priority
//=============
function get_priority(){
var priority;
priority =
XDocument.DOM.selectSingleNode("/my:RFCDetails/my:GeneralInfo/my:RFCPriority");
return priority;
}

//==============================
//Button Initializer (Important)
//==============================
function buttonInitializer(){
var iPriority;
var iCategory;
var iStatus;
var iMileStone;
var iRole;

iPriority = get_priority();
iCategory = get_category();
iStatus = get_status();
iMileStone = get_mileStone();
iRole = get_UserRole();
if(iCategory == "1" && iStatus == "2" && iMileStone == "0" && iRole
== "IMRFC-CM"){
checkApproval();
set_ApprovalID(1);
}else if(iStatus == "2" && iMileStone == "0" && iRole ==
"IMRFC-CM"){
checkApproval();
set_ApprovalID(2);
}else if(iStatus == "4" && iMileStone == "1" && iRole ==
"IMRFC-CAB"){
checkApproval();
set_ApprovalID(3);
//error happens at this if else statement below (ipriority ==...)
}else if(iPriority == "4" && iStatus == "2" && iMileStone == "2" &&
iRole == "IMRFC-eCAB"){
checkApproval();
set_ApprovalID(4);
}else{
uncheckApproval();
set_ApprovalID(0);
}
}



Generally all the getters use the same logic as seen in the one above.
I've pin pointed it to the iPriority variable which receives a string
from the form. For some reason it seems to get through the case
statement until the iPriority variable gets involved.I understand this
is a fair bit of code, but we're implementing about a thousand lines of
logic in infopath Jscript (maybe not the best idea). If anyone has any
insight I would appreciate it a lot. Thanks
Eric
 
S

S.Y.M. Wong-A-Ton

iPriority gets a reference to a DOM node through the get_priority() getter
method. Probably the XPath expression used to retrieve the node is incorrect
and not returning the desired DOM node. Check whether iPriority is null
before using it.

Another possibility: In the statement iPriority == "4" you are comparing a
DOM node to a string. You probably need to use the following:

iPriority.text == "4"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top