Set viewScope under computed text as link

I want to make a dynamic list of links. Under a computed text control, i have this code :

var aHtml=“

    ”;

    var result = @Unique(getComponent(“books”).getValue ());

    for (i=0; i<result.length; i++) {

    aHtml+="<li><a href=\"#\" onclick=\"viewScope.dossier='"+result[i]+"'\">"+result[i]+"</a></li>"
    

    }

    return aHtml + “

In the browser i have this error : “viewScope is undefined”.

What is wrong ?

Thank you in advance.

Subject: viewScope

did you get my email on this?

how is viewScope.dossier getting a value? It looks like what ever is supposed to be populating it might not be? Or is running later then the code you posted…

But I’ve been wrong before… :slight_smile: