Override toString of a function/json/object

Avatar

Avatar

Magus069

MVP

Avatar

Magus069

MVP

Magus069
MVP

16-02-2016

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

Replies

Avatar

Avatar

_Bruce_Robertson

MVP

Avatar

_Bruce_Robertson

MVP

_Bruce_Robertson
MVP

18-02-2016

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

Avatar

Magus069

MVP

Avatar

Magus069

MVP

Magus069
MVP

18-02-2016

Thanks for answering my question.

Really appreciated!