I have a leaderboards page for student’s to view and compare stats. Since I’m running low on custom fields for my CMS, I use one custom field that’s an array to collect most data I need.
In the leaderboards is a collection list of all students ranked from highest to lowest. I’m using an embed in their collection item to list their physical stats. The problem is that when I use getElementById to write the array data to a specific text, it will only do one of the collection items and the rest remain blank.
Even when I used a custom field to make each ID to have unique ID for each collection item, it still wouldn’t work. I’m looking for alternatives for me to show the array data on the text and to make sure it works on ALL collection items, not just one.
Collection Item Embed Code:
<div class="leaderboard-stats">
<div class="skill-stat-group">
<img class="leaderboard-skill" src="https://uploads-ssl.webflow.com/6136fb2c901e59c517d78526/63b3e432d1ecde5c3f22c77f_YFN%20Academy%20Icons%20%5BRecovered%5D-70.svg">
<p class="skill-level" id="agility{{wf {"path":"member-id","type":"PlainText"\} }}">0
</p>
</div>
<div class="skill-stat-group">
<img class="leaderboard-skill" src="https://uploads-ssl.webflow.com/6136fb2c901e59c517d78526/63b3e43b1f032e18224ddcb0_YFN%20Academy%20Icons%20%5BRecovered%5D-65.svg">
<p class="skill-level" id="clarity{{wf {"path":"member-id","type":"PlainText"\} }}">0
</p>
</div>
<div class="skill-stat-group">
<img class="leaderboard-skill" src="https://uploads-ssl.webflow.com/6136fb2c901e59c517d78526/63b3e44143a073449650263c_YFN%20Academy%20Icons%20%5BRecovered%5D-67.svg">
<p class="skill-level" id="coordination{{wf {"path":"member-id","type":"PlainText"\} }}">0
</p>
</div>
<div class="skill-stat-group">
<img class="leaderboard-skill" src="https://uploads-ssl.webflow.com/6136fb2c901e59c517d78526/63b3e441157c55aa3e0c7006_YFN%20Academy%20Icons%20%5BRecovered%5D-69.svg">
<p class="skill-level" id="endurance{{wf {"path":"member-id","type":"PlainText"\} }}">0
</p>
</div>
<div class="skill-stat-group">
<img class="leaderboard-skill" src="https://uploads-ssl.webflow.com/6136fb2c901e59c517d78526/63b3e436d98188269155b783_YFN%20Academy%20Icons%20%5BRecovered%5D-62.svg">
<p class="skill-level" id="flexibility{{wf {"path":"member-id","type":"PlainText"\} }}">0
</p>
</div>
<div class="skill-stat-group">
<img class="leaderboard-skill" src="https://uploads-ssl.webflow.com/6136fb2c901e59c517d78526/63b3e43443a073761b502520_YFN%20Academy%20Icons%20%5BRecovered%5D-58.svg">
<p class="skill-level" id="patience{{wf {"path":"member-id","type":"PlainText"\} }}">0
</p>
</div>
<div class="skill-stat-group">
<img class="leaderboard-skill" src="https://uploads-ssl.webflow.com/6136fb2c901e59c517d78526/63b3e436d1ecde0e7622c78d_YFN%20Academy%20Icons%20%5BRecovered%5D-61.svg">
<p class="skill-level" id="power{{wf {"path":"member-id","type":"PlainText"\} }}">0
</p>
</div>
<div class="skill-stat-group">
<img class="leaderboard-skill" src="https://uploads-ssl.webflow.com/6136fb2c901e59c517d78526/63b3e43f19c92c30714fac5d_YFN%20Academy%20Icons%20%5BRecovered%5D-66.svg">
<p class="skill-level" id="quickness{{wf {"path":"member-id","type":"PlainText"\} }}">0
</p>
</div>
<div class="skill-stat-group">
<img class="leaderboard-skill" src="https://uploads-ssl.webflow.com/6136fb2c901e59c517d78526/63b3e43643a073e051502559_YFN%20Academy%20Icons%20%5BRecovered%5D-60.svg">
<p class="skill-level" id="discipline{{wf {"path":"member-id","type":"PlainText"\} }}">0
</p>
</div>
<div class="skill-stat-group">
<img class="leaderboard-skill" src="https://uploads-ssl.webflow.com/6136fb2c901e59c517d78526/63b3e43d5bacad237a3d81da_YFN%20Academy%20Icons%20%5BRecovered%5D-63.svg">
<p class="skill-level" id="speed{{wf {"path":"member-id","type":"PlainText"\} }}">0
</p>
</div>
<div class="skill-stat-group">
<img class="leaderboard-skill" src="https://uploads-ssl.webflow.com/6136fb2c901e59c517d78526/63b3e4411f032ee8ab4ddd35_YFN%20Academy%20Icons%20%5BRecovered%5D-68.svg">
<p class="skill-level" id="stability{{wf {"path":"member-id","type":"PlainText"\} }}">0
</p>
</div>
<div class="skill-stat-group">
<img class="leaderboard-skill" src="https://uploads-ssl.webflow.com/6136fb2c901e59c517d78526/63b3e4348a9d051735bc5805_YFN%20Academy%20Icons%20%5BRecovered%5D-57.svg">
<p class="skill-level" id="stamina{{wf {"path":"member-id","type":"PlainText"\} }}">0
</p>
</div>
<div class="skill-stat-group">
<img class="leaderboard-skill" src="https://uploads-ssl.webflow.com/6136fb2c901e59c517d78526/63b3e43b2ac12c6904cd9612_YFN%20Academy%20Icons%20%5BRecovered%5D-64.svg">
<p class="skill-level" id="strength{{wf {"path":"member-id","type":"PlainText"\} }}">0
</p>
</div>
<div class="skill-stat-group">
<img class="leaderboard-skill" src="https://uploads-ssl.webflow.com/6136fb2c901e59c517d78526/63b3e436196e1852f9ba6302_YFN%20Academy%20Icons%20%5BRecovered%5D-56.svg">
<p class="skill-level" id="toning{{wf {"path":"member-id","type":"PlainText"\} }}">0
</p>
</div>
</div>
<script>
const skillsetArray = [{{wf {"path":"skill-points-array","type":"PlainText"\} }}];
var agility = skillsetArray[0];
var clarity = skillsetArray[1];
var coordination = skillsetArray[2];
var endurance = skillsetArray[3];
var flexibility = skillsetArray[4];
var motivation = skillsetArray[5];
var patience = skillsetArray[6];
var power = skillsetArray[7];
var quickness = skillsetArray[8];
var discipline = skillsetArray[9];
var speed = skillsetArray[10];
var stability = skillsetArray[11];
var stamina = skillsetArray[12];
var strength = skillsetArray[13];
var toning = skillsetArray[14];
document.getElementById("agility{{wf {"path":"member-id","type":"PlainText"\} }}").innerHTML = agility;
document.getElementById("clarity{{wf {"path":"member-id","type":"PlainText"\} }}").innerHTML = clarity;
document.getElementById("coordination{{wf {"path":"member-id","type":"PlainText"\} }}").innerHTML = coordination;
document.getElementById("endurance{{wf {"path":"member-id","type":"PlainText"\} }}").innerHTML = endurance;
document.getElementById("flexibility{{wf {"path":"member-id","type":"PlainText"\} }}").innerHTML = flexibility;
document.getElementById("patience{{wf {"path":"member-id","type":"PlainText"\} }}").innerHTML = patience;
document.getElementById("power{{wf {"path":"member-id","type":"PlainText"\} }}").innerHTML = power;
document.getElementById("quickness{{wf {"path":"member-id","type":"PlainText"\} }}").innerHTML = quickness;
document.getElementById("discipline{{wf {"path":"member-id","type":"PlainText"\} }}").innerHTML = discipline;
document.getElementById("speed{{wf {"path":"member-id","type":"PlainText"\} }}").innerHTML = speed;
document.getElementById("stability{{wf {"path":"member-id","type":"PlainText"\} }}").innerHTML = stability;
document.getElementById("stamina{{wf {"path":"member-id","type":"PlainText"\} }}").innerHTML = stamina;
document.getElementById("strength{{wf {"path":"member-id","type":"PlainText"\} }}").innerHTML = strength;
document.getElementById("toning{{wf {"path":"member-id","type":"PlainText"\} }}").innerHTML = toning;
</script>
Any help is appreciated!
Here is my site Read-Only:(Webflow - YFN Academy)**