Cannot assign to a function result

Hi,

I keep getting this error message when I'm testing Popfly. I have created a simple block but when I try to build a mash with it I get the above mentioned error message.

I cannot find the error in the code. Is there any good way to verify block code and get decent error messages referring to lines etc?

[331 byte] By [herbj?rn] at [2008-2-19]
# 1
Could you share the block and post your account name and project name? Thanks!
AndyS at 2007-9-26 > top of Msdn Tech,Popfly,Popfly General Discussion...
# 2

Hi,

The block is shared now. My account name is herbjorn and the name of the block is MyPlaces.

Thanks for helping out!

herbj?rn at 2007-9-26 > top of Msdn Tech,Popfly,Popfly General Discussion...
# 3

Couple of things that might be causing problems:

Code Snippet
City.prototype.toString() = function()

The () on the troString isn't needed that's true for all functions using the prototype. Instead:

Code Snippet
City.prototype.toString = function()

This assigns a function to a the toString field which is what you want to do, though i believe both ways work in IE.

Also you don't need the __ on getCities, the node:

Code Snippet
<operation name="getCities" callMode="both">

Has an attribute "name" which needs to match the name of the function in javascript in this case either change the xml attirbute to __getCities or rename the function. The use of __ is not required any more to hide functions in the designer.

Lastly you need to change:

Code Snippet
for (var index = 0; i< locationArray.length; index++)

to

Code Snippet

for (var index = 0; index < locationArray.length; index++)

I didn't test the block, so there might be more if so just post back here Smile.

AndyS at 2007-9-26 > top of Msdn Tech,Popfly,Popfly General Discussion...
# 4

Hi!

I can now use the block in a mashup, but I get the error message "A function was expected!" Sad

herbj?rn at 2007-9-26 > top of Msdn Tech,Popfly,Popfly General Discussion...