Expand my Community achievements bar.

Override toString of a function/json/object

Avatar

Level 10

Hi everyone,

for some reasons I am not able to override the toString function using prototype.toString = function(){}...

I made it work using a different name like toDisplayString(), but it is not convenient to have another function name for the result wanted...

here's how my object look like :

I would like to have function toDisplayString named toString instead. But using Tasks.prototype.toString = function(){} doesn't seem to be working...

is anyone aware of any issue regarding toString override within LiveCycle?

Thanks for your time

2 Replies

Avatar

Level 10

Hi,

I don't understand why but you can't override the toString() or the valueOf(), I've ended up doing the same sort of thing as you with a slightly different name, but means you can't handle objects in a generic way, and it's made it very hard to port some JavaScript libraries across.

It does seem you can override both in Reader DC ... but I guess that wont help for some years to come.

Bruce

Avatar

Level 10

Thanks for answering my question.

Really appreciated!