This project is read-only.

CheckAuthorName is not defined

Topics: ASP.NET 2.0
Jun 21, 2009 at 4:43 PM

Clicking the "Save Comment" button does not save but seems to raise an error. Looking at this with Firefox I can see that CheckAuthorName is not defined, but this is in WebResource.axd so I'm not really sure where to start looking to debug further.

To see what I mean try adding a comment to a post on my site

Any suggestions greatly appreciated.

Jun 23, 2009 at 3:54 PM

I have tried suggestions from other similar posts, such as hard coding a reference to blog.js or Firefox being the problem - but I am still stuck with this and Comments cannot be added.

Jun 23, 2009 at 5:15 PM

Update: The function CheckAuthorName is in blog.js (along with other functions like SetFlag), however when the page tries to execute the function it cannot find it.

I don't get it and I'm no JavaScript guru so don't really know what to look for here. I can see the JavaScript file is being included in the page, I can see the function in there if I drill into it with Firebug - but the event handlers on the button submit (and also the countries drop down list) are not able to find the functions and they are not firing.

No one can post comments or change their country / flag.

Please help!

Jun 24, 2009 at 4:26 AM

Good detective work!  Here's the problem ... your blog.js file is the one that comes with BE -- which is correct since it looks like you're using the BE DLL.

However, the CommentView.ascx file in your User Controls folder is an older version -- probably from BE 1.4.5.  In the CommentView.ascx file of BE the JS calls for setting the flag is BlogEngine.setFlag().  In the old CommentView.ascx file, it was SetFlag() -- which is what I'm seeing on your blog when doing a View Source.  So you've got a version mismatch.  Similar changes to other JS function calls were made in BE

I would make sure you're using all the BE files for the User Controls folder, and other folders too.

Jun 24, 2009 at 5:46 PM

Hi Ben,

Thanks for your help!

I fixed the version mismatch and that solved the problem. When I upgraded I used BeyondCompare to highlight folders where there were changes between my old versions with the new files - I have modified the html markup slightly (changed <p tags to <h2 where that made more sense etc) so I didn't just replace all files.

Comments are now working again :)

Thanks again.