Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for some debugging direction? 1

Status
Not open for further replies.

BobMCT

IS-IT--Management
Sep 11, 2000
756
US
Hi all,
While I'm no where near a js expert I do dabble in it for some web purposes. I have an application that for years now has used an onchange event to run a function that dynamically constructs an html select set. I've recently done some upgrades to my server (ubuntu 13.10) and I've suddenly started experiencing some js errors indicated by the firebug console. Specifically it states:
TypeError: select is null
Line 106
and line 106 is: select.options.length = 0;
which is what is normally used to clear the prior content of the select option list.

I've also started getting some null getElementById value errors as well.

So I'm not asking for anyone to solve this for me, just venting and wondering if I'm missing something and where I might be able to search for this/these errors? I'm most interested in the first error (TypeError: select is null).

If anyone can suggest where else to look (as in other areas of typical routines/functions) I'd be most gracious and I don't have much hair left to continue pulling out.

Thanks - (heavy sigh) [ponder]
 
i cannot think of any reason why a server side upgrade would affect client side code.

perhaps some of the code is being generated by a server side script (php perhaps)? or the locations/paths of some server side resources has been changed?

most likely however is that something is off in your javascript and the id of the select box has changed thus cannot be found and is giving you these null errors. feel free to post the code or point us to a web site where the error lies.
 
Has there been a client browser upgrade? Are end user and development machine browsers having exact same error?

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
As jpadie suggests, the error simply indicates the "select" variable is null, and as such can;t have those properties.

Why its null, well is something you'll need to find out. Like Jpadie also said, maybe the ID used to target the object was changed or no longer exists.
Your second error ( null getElementById) points to this being the case. If getElementById is not returning an element because it can;t find one, then the variable will be null. And attempting to use it will cause such errors.

Start by checking how you are setting the select variable. Then make sure whatever is setting it is correctly doing it.

The server side update should not have affected the client side js code so this was something that already existed, or was introduced by something other than the update.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Thanks guys (and especially Phil). I'm sure you could see my frustration in last night's post. After hours of debugging often the trees get in the way of the forest. Today is a different day and I'll be taking all your advice to heart. Have a great day.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top