function viewTeams() {

  getTeams(
    success = function (data) {
      populateTeamsTable(data.teams);
    },
    error = function (jqxhr) {
      handleApiError(jqxhr);
    }
  );

  function populateTeamsTable(data) {
    var teams = _.sortBy(data, function (d) {return d.name.toLowerCase()});
    var teamsHtml = templates.teamList(teams);
    $('.section').html(teamsHtml);

    $('.collections-select-table tbody tr').click(function () {
      $('.collections-select-table tbody tr').removeClass('selected');
      $(this).addClass('selected');
      var teamId = $(this).attr('data-id');
      viewTeamDetails(teamId);
    });

    $('.form-create-team').submit(function (e) {
      e.preventDefault();

      var teamName = $('#create-team-name').val();

      if (teamName.length < 1) {
        sweetAlert("Please enter a user name.");
        return;
      }

      postTeam(teamName);
    });
  }
}



@@ -865,16 +865,50 @@
      %7D%0A%0A
+      teamName = teamName.trim();%0A
       po

Trim the team name before adding new team.