Autograder errors: Assignment #5

Hi guys,

I’ve been posting on here a lot lately with Assignment 5. So thanks again for your time and help.

I’m getting the same 4 autograder errors, all related to manipulating the DOM for each of the 4 scenarios for fuelLevel and cargoMass.

My page is working exactly as it should. I have gone back and made sure the wording is exactly the same as is specified in the grading.dom.spec.js, but I’m still getting these autograder errors. It seems like, according to the autograder, my page never changes from what is listed in index.html in the faultyItems div, but again, the page is functioning exactly as it should so I’m not sure why the autograder isn’t seeing this.

Has anyone else had this problem? Not sure how to go forward. Thanks in advance.
Screen Shot 1 Screen Shot 2

What info are you passing to the formSubmission function and how is it updating the DOM? Looks like it is not updating it the way the autograder expects.

Hi @rlp390 yeah I think you’re right and I’ve recently changed my code in script.js to try to help with this (see my first few lines below) - BUT I also define these variables in my formSubmission() function within scriptHelper.js with the exact same few lines of code (apart from document which is only defined within script.js as below). This seems repetitive, so I’m not sure this is the right thing to do.

window.addEventListener(“load”, function() {
let document = window.document;
let faultyItems = document.getElementById(“faultyItems”);
let pilotName = document.querySelector(“input[name = pilotName]”);
let copilotName = document.querySelector(“input[name = copilotName]”);
let fuelLevelL = document.querySelector(“input[name = fuelLevel]”);
let cargoMassKg = document.querySelector(“input[name = cargoMass]”);
formSubmission(document, faultyItems, pilotName, copilotName, fuelLevelL, cargoMassKg);

It looks like you are passing the input fields instead of the values from those input fields. You will need to change formSubmission to formSubmission(document, faultyItems, pilotName.value, copilotName.value, fuelLevelL.value, cargoMassKg.value); and adjust the code to work with those values.

from the grading DOM spec file you can see the autograder passes the values directly into the function, so having it setup to take the input fields then convert to values in the function won’t pass.

“studentFunctions.formSubmission(window.document, list, “Chris”, “Bob”, 0, 5);”

Hi @rlp390 that makes sense, thanks you for the explanation!

The beginning of my code in script.js now has the variable definitions like above but I’ve also added in .value to the relevant variables like you mentioned when I call the function in script.js.

In scriptHelper.js for formSubmission(), I’ve taken out the variable definitions and all reference to .value so that I’m not converting input fields to values within the function. The code looks much better now and is again back to working perfectly as it should on the webpage, but I’m still failing the 4 DOM manipulation tests.

Anyone else get stuck over this? I know it must be something simple I’m missing in relation to the values and the DOM and I’m dying to learn what it is.