?
Solved

prototype.js: $F(foo) = "element has no properties" -- but which element?

Posted on 2006-06-16
5
Medium Priority
?
592 Views
Last Modified: 2010-08-05
I'm getting an "element has no properties" on line 1276 of prototype.js, which is almost certainly a result of a call I'm making in the $F('fieldname') syntax.  I know what usually causes this-- misspellings of 'fieldname', or neglecting the quotes around it if it's a string literal.  Generally an easy fix.

Thing is, I've just connected many, many untested functions with many, many instances of $F('whatever').  Looking through them is excrutiating, and breaking apart the functions to test them individually is not a desirable solution.  Is there a way to toss in some error-handling or event-logging that'll give me a better idea about what attempted element is failing?
0
Comment
Question by:Rakafkaven
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 4

Author Comment

by:Rakafkaven
ID: 16924357
I just tried one thing-- inserting this line right above 1276:

$(temporaryfield).value = element.id;

This means that when the error hits,temporaryfield holds the id of the last element that was successfully parsed, which does narrow it down somewhat.  Still not a great solution.
0
 
LVL 4

Author Comment

by:Rakafkaven
ID: 16924372
Changing that line to:

$(temporaryfield).value = $(temporaryfield).value + "," + element.id;

...gives me a full log of successful parses, which should let me track down the culprit.  But if there's a way to return the line number or attempted-element name or any other more graceful approach, I'll be glad to award points for it.
0
 
LVL 4

Author Comment

by:Rakafkaven
ID: 16924628
Hey, mozilla has a built-in debugger.  Fancy that.  A little RSI with the "Step Into", and there I see where I tried to pass an entire array to my $F(whatever), rather than a single array element.  That helps some.
0
 
LVL 4

Author Comment

by:Rakafkaven
ID: 16924688
Well, I don't usually answer my own questions THAT quickly.  So... uh... tell me something interesting about debugging.  Seems a shame to let perfectly good points go to waste.
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 2000 total points
ID: 16926580
My first step in such situations is to disable the onLoad handlers by commenting them out //
Then I look for simple syntax errors. Most runtime errors are rooted in tricky syntax errors which are overloaded at starting some undefined functions whose definition lacks on syntax follow up errors.
When I get that far I spot some simple alerts(1), alert(2) at spots outside of any function or statement block. If the alerts do not occur in the order I expect, then I know that interpreter is scanning my source in some other way then I see it. Most again because of missing closing or opening curly braces. When the alerts then come in desirable order, then I know at least we see the same functions and then first I start debug function, most with alerts and seldom with debugger.


0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question