Quantcast
Channel: Adobe Community : All Content - LiveCycle Designer
Viewing all articles
Browse latest Browse all 5571

Override toString of a function/json/object

$
0
0

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 :

var Tasks =function Tasks(id, oneTask) {

      this.ID = id;

      this.CatID = oneTask.CatID;

      this.Task = {"EN": oneTask.Task["EN"],"FR": oneTask.Task["FR"]};

      this.SubTask ="";

      this.Selected =false;

      this.toDisplayString =function(boNumber){

           if (boNumber){

                return this.Task[strPreviewLang] ==""? this.Task["EN"] : this.Task[strPreviewLang];

           } else{

                return removeNumbers(this.Task[strPreviewLang] ==""? this.Task["EN"] : this.Task[strPreviewLang]);

           }

      this.getTaskNumber =function(){

           return retrieveNumber(this.Task[strPreviewLang] ==""? this.Task["EN"] : this.Task[strPreviewLang]);

      }

}

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


Viewing all articles
Browse latest Browse all 5571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>