injecting into table, created table header, and buttons for each row

This commit is contained in:
Sriram Hariharan
2023-03-03 21:57:00 -06:00
parent beb61176c1
commit e9c420a873
7 changed files with 111 additions and 18 deletions

View File

@@ -0,0 +1,20 @@
/**
* The course schedule page has a search form that allows users to search for courses by department and course level.
* The problem is that once the user triggers a search and refreshes the page,
* for some reason the search form is cleared and the user has to re-enter their search parameters. This fixes that lol
*/
export function populateSearchInputs() {
let params = new URL(window.location.href).searchParams;
let department = params.get('fos_fl');
let courseLevel = params.get('level');
if (!department || !courseLevel) return;
const depInput = document.querySelector<HTMLInputElement>('#fos_fl');
const levelInput = document.querySelector<HTMLInputElement>('#level');
if (!depInput || !levelInput) return;
depInput.value = department;
levelInput.value = courseLevel;
}