Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / April 2005

Tip: Looking for answers? Try searching our database.

'null' is null or not an object

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Taja - 21 Jan 2005 01:28 GMT
Hi,

When executing the following code in the onload event, i get the error:

'null' is null or not an object

I just want to fill-in the username in one of the query fields, before
invoking the query submit.

What's going wrong ?

thx for support

var objNetwork = new ActiveXObject("WScript.Network");
userName = objNetwork.UserName;
wshNetwork = null;

var queryHans =
XDocument.DOM.selectSingleNode("/my:myFields/my:queryFields/q:tbl_names" );
queryHans.selectSingleNode("@username").text = userName;
Greg Collins [InfoPath MVP] - 21 Jan 2005 15:16 GMT
If you remove the following line, does it then work?
   wshNetwork = null;

Signature

Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com

Hi,

When executing the following code in the onload event, i get the error:

'null' is null or not an object

I just want to fill-in the username in one of the query fields, before
invoking the query submit.

What's going wrong ?

thx for support

var objNetwork = new ActiveXObject("WScript.Network");
userName = objNetwork.UserName;
wshNetwork = null;

var queryHans XDocument.DOM.selectSingleNode("/my:myFields/my:queryFields/q:tbl_names" );
queryHans.selectSingleNode("@username").text = userName;
Enterprise Andy - 19 Apr 2005 10:46 GMT
I'm trying to do the same thing in my code:

function XDocument::OnLoad(eventObj)

{

var objNetwork = new ActiveXObject("WScript.Network");

userName = objNetwork.UserName;

var queryHans =    
Document.DOM.selectSingleNode("/my:myFields/my:queryFields/q:TblStaffDetails"
);

queryHans.selectSingleNode("@UserName").text = userName;  

}

But I'm getting the 'null' error message. The error is one the final line,
where the code is retrieving my username, but not assigning it the the
@UserName field....

Anyone got any ideas why not?
Mike Sharp - 19 Apr 2005 18:17 GMT
You might try qualifying the XPath with the namespace:

queryHans.selectSingleNode("q:@UserName").text = userName;

It's generally a good idea to test the result of a selectSingleNode method
to see if it contains a node or not.  It returns null if the XPath fails to
find a node.

oNode = queryHans.selectSingleNode("q:@UserName").text = userName;
if (oNode != null){
   oNode.text = userName + "";
}

Regards,
Mike Sharp

> I'm trying to do the same thing in my code:
>
[quoted text clipped - 7 lines]
>
> var queryHans =

Document.DOM.selectSingleNode("/my:myFields/my:queryFields/q:TblStaffDetails
"
> );
>
[quoted text clipped - 7 lines]
>
> Anyone got any ideas why not?
Enterprise Andy - 20 Apr 2005 09:10 GMT
All I needed to do was to changed the 'my' to 'dfs' and the code works!
Working code is as follows (Just to help people out if they have the same
problems as me!):

function XDocument::OnLoad(eventObj)

{

var objNetwork = new ActiveXObject("WScript.Network");

userName = objNetwork.UserName;

var queryHans =  
Document.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:TblStaffDetails"
);

queryHans.selectSingleNode("@UserName").text = userName;

}
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.