• We just upgraded the platform on which this website runs! Please inform @Jaxel of any issues.

Importing a list

moshiro

New member
Hi there, thanks for the great work. I have learned some basic coding and with a little help from a friend have managed to set up a great scoreboard. The one thing we haven't managed to do is import two text lists of units onto the overlay, one for each player. Any suggestions?
 

moshiro

New member
Apologies for the late response. By import I mean either on of the following options:
1. copy pasting a text format of an army list into a 'list' field of the dasgboard. While having it formatted in such a way that each 'unit' entry is on a different line. I tried using the <br> code in the page 'field'
2. Putting in a link from a army building app into the dashboard to import the list automatically.

Hope this is clear enough? I'm a bit confused myself I must add
 

moshiro

New member
Ill give an example. I would like to get a similair result to this video: Example
Right now I can manage to create the field on the side and copy paste the text in it but my list is one big block of text.
 

Jaxel

Administrator
Ahh... you're trying to do line breaks in your fields, but HTML entities such as <br/> are being printed in plain text, instead of as HTML, is that correct?

The code I included in my advanced scripting tutorial is designed to do exactly this:
Code:
function elemUpdate() {
    return function (next) {
        for (var prop in docData) {
            $('#'+prop).text(docData[prop]);
        }
        next();
    }
}
As you can see, it inserts the data as .text(); this function translates HTML entities. If you want to display HTML, change the function to .html(). But then you'll have to make sure not to use HTML entities when you want to display text, such as <, > and &.
 

moshiro

New member
Ahh... you're trying to do line breaks in your fields, but HTML entities such as <br/> are being printed in plain text, instead of as HTML, is that correct?

The code I included in my advanced scripting tutorial is designed to do exactly this:
Code:
function elemUpdate() {
    return function (next) {
        for (var prop in docData) {
            $('#'+prop).text(docData[prop]);
        }
        next();
    }
}
As you can see, it inserts the data as .text(); this function translates HTML entities. If you want to display HTML, change the function to .html(). But then you'll have to make sure not to use HTML entities when you want to display text, such as <, > and &.
Perfect, very glad you figured out what I meant, thanks!