Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

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!