lengleng Posted June 29, 2021 Report Share Posted June 29, 2021 I'm trying to put List-String in my HTML block but it's displaying as comma separated instead of a list type, how can I make it look like when it's a field set to Display Only? Quote Link to comment Share on other sites More sharing options...
TellMeWhy Posted June 29, 2021 Report Share Posted June 29, 2021 I'm not sure where you need this for since you've already mentioned it's the same as the Display Only one, however, this can be done through JavaScript First, create an HTML block, Disable HTML Editor, and add this <ul id="listing"> </ul> This is where the values will be listed Next on the Footer <script> //CHANGE THE FIELD var listString= "[@field:ListNUm]"; var mainList = document.getElementById("listing"); var arrayList = listString.split(','); for(var i=0;i<arrayList.length;i++){ var elem = document.createElement("li"); elem.value=arrayList[i]; elem.innerHTML=arrayList[i]; mainList.appendChild(elem); } </script> Change the field in the var listString using the FIELD PICKER, make sure you're using String, if it's a List-number DataType, still use String. This is how it looks, ListNUm is the Display Only Field, Just the Field is an HTML Block where I inserted the ListNUm field, Listed is an HTML block using this method. NOTE: What this does is separate the value between commas, so, if you have commas in your List-String choices, this will not work for you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.