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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Rotate images for Web Page 11 40
Put javascript to get dropdown value 3 34
Check if field exists SPUtility 5 48
Changing the format from a text box to a drop-down menu 9 37
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

752 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