cancel
Showing results for 
Search instead for 
Did you mean: 

how to write data to an aspcet using java script

friedman30
Champ in-the-making
Champ in-the-making
hi,

i have added a custom aspect:

<aspect name="custom:ThumbnailAspect">
           <title>Thumbnail Aspect</title>
            <associations>
             <association name="custom:Thumbnail">
                <title>Thumbnail</title>
                <source>
                 <many>true</many>
              </source>
                <target>
                   <class>cm:content</class>
                   <mandatory>false</mandatory>
                         <many>false</many> <!– allow only one thumbnail to be added –>
                   </target>
               </association>
          </associations>
         </aspect>
now, i need to add the content of this aspect (which will be a link to another file) using a java script.

i am running this script:
var props = new Array(1);
          props["custom:Thumbnail"] = PATH;
          var added=  document.addAspect("custom:ThumbnailAspect", props);

where document is the content that holds the aspect, and PATH is the value i want to add.
after running it, the value of added is true (and i do have a new thumbnail value added to the content), but the value (PATH) is still empty….

i can't find a way to set the value for an aspect…

any ideas???  :shock:
10 REPLIES 10

kevinr
Star Contributor
Star Contributor
From the title of your post I assume you mean JavaScript not Java. It is not possible in 2.0, the API is there in 2.1.

Thanks,

Kevin