Search code examples
firebaseleaderboardhitcounter

How to increase the Fields of input in Firebase Leaderboard


Go to http://goo.gl/I4XLKF (Link to my jsfiddle workout)

Here I have tried to increase the input fields/option for Firebase LeaderBoard (https://www.firebase.com/tutorial/#example/leaderboard), But it is Not working.

I have defined 3 Inputs/Firebase elements

  • name - this element/child is for the name of website
  • AlternateURL - this element/child is for the URL of website
  • Score - this element/child is for setting priority to the URL by entering numerical values.

I am using this LeaderBoard script to allow my users to sumbit alternate url for the various apps.


Solution

  • I think in this section, you only need to use the name field to reference the row and not your alternateurl.

    // Store a reference to the table row so we can get it again later.
    htmlForPath[scoreSnapshot.name()] = newScoreRow;
    htmlForPath[scoreSnapshot.AlternateURL()] = newScoreRow;
    

    get rid of the last line.

    Unless there is an error somewhere else, you've addressed the areas to change/add code (variable names are my version:

    <input type="text" id="urlInput" placeholder="URL">
    newScoreRow.append($("<td/>").text(scoreSnapshot.val().url));
    var url1 = $("#urlInput").val();
    userScoreRef.setWithPriority({ name:name, score:newScore, url:url1}, newScore);