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

Posted on 2006-06-16
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?
Question by:Rakafkaven
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

Author Comment

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

$(temporaryfield).value =;

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.

Author Comment

ID: 16924372
Changing that line to:

$(temporaryfield).value = $(temporaryfield).value + "," +; 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.

Author Comment

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.

Author Comment

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.
LVL 63

Accepted Solution

Zvonko earned 500 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.


Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
In Part 1 ( we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…
Suggested Courses

622 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