jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nemix <ereas_...@hotmail.com>
Subject Follow a reference property
Date Wed, 12 Aug 2009 10:38:33 GMT

Hi everybody,


I have some problems using Reference property in javascript.


At the moment, my CRX repository looks like that :
 - drugs (nt:unstructured)
 --- drug1 (nt:unstructured)
 ------ name (String)
 ------ uuid
 --- drug2 (nt:unstructured)
 ------ name (String)
 ------ uuid
 - categories (nt:unstructured)
 --- cat1 (nt:unstructured)
 ------ prop11 (Reference on drug1)
 ------ prop12 (Reference on drug2)
 ------ ...
 --- cat2 (nt:unstructured)
 ------ prop21 (Reference on drug1)
 ------ ...

Nodes under "drugs" are referenceable, so each of them have a UUID.
Moreover, they have a string property : name.
Nodes under catX have properties that are Reference on the previous UUID.

If I click in the repository on those references, it leads me correctly to
the nodes unders "drugs".


I have a JSP page in which I have :
<input type="radio" name="category" value="cat1"
onClick="changeDrugs(this.value)"> 1
<input type="radio" name="category" value="cat2"
onClick="changeDrugs(this.value)"> 2


I would like that each time I change the selection of the radio button, it
calls changeDrugs() function to display the name of each reference (example
: if click on "cat1" radio button, it retrieve prop11 and prop12, "make the
link" thanks to the reference throught drugs and retrieve the name of the
drug). 

This function is in a javascript file : utils.js
function changeDrugs(idr) {
 var form_d ='';
 if(idr != "null"){
  var drugsList = Sling.getContent("/content/tb_monitoring/categories/"+idr,
2);
  for(var j in drugsList) {
   form_d += '<input type="checkbox" name="'+drugsList[j].name+'"
value="'+drugsList[j].name+'" >'+drugsList[j].name+'  <br/>';
  }
 }else{
  form_d = "";
 }
 document.getElementById("blocDrugs").innerHTML = form_d;
} 


But drugList[j].name display "undefined".
I have tried a couple of other things but doesn't work :
drugList[j]["jcr:path"] -> undefined
drugList[j] -> display the value of the reference, so something like
4a6b8283-377e-4c45-9080-f821229217e4
 

Do someone have any idea ?

Thanks in advance  ;)

Audrey

-- 
View this message in context: http://www.nabble.com/Follow-a-reference-property-tp24933866p24933866.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message