diff --git a/public/scripts/manage/game.js b/public/scripts/manage/game.js index 0cc134b..82d4cb8 100644 --- a/public/scripts/manage/game.js +++ b/public/scripts/manage/game.js @@ -25,6 +25,8 @@ async function initializeForm() { const game = await Data.getGame(gameID); + Form.addHiddenValue('game', gameID, submissionForm); + Form.populateSeasons(seasonDropdown, game.seasonID); Data.getDivision(game.divisionID) .then(data => { diff --git a/routes/manage.js b/routes/manage.js index 9757e69..16f8ca4 100644 --- a/routes/manage.js +++ b/routes/manage.js @@ -35,7 +35,7 @@ router.post('/game', function(req, res, next) { if(remove) games.remove(id) .then(res.redirect("/manage")); - else if(id) games.edit(id, divisionId, seasonID, date, team1ID, team2ID, team1Score, team2Score) + else if(id) games.edit(id, divisionID, seasonID, date, team1ID, team2ID, team1Score, team2Score) .then(res.redirect('/manage')); else games.add(divisionID, seasonID, date, team1ID, team2ID, team1Score, team2Score) .then(res.redirect("/manage")); diff --git a/views/manage/addgame.pug b/views/manage/addgame.pug index 039bfd1..7981148 100644 --- a/views/manage/addgame.pug +++ b/views/manage/addgame.pug @@ -7,7 +7,7 @@ block stylesheets block content div#mobile-view h1 #{title} - form#submission-form(action='./submitgame', method='POST') + form#submission-form(action='./game', method='POST') span(class='form-section') label Year span(class='form-section-input')