Question: anyone would help me please with this homework >> Hands-On Project 4-1 In this project, youll continue working with the tuba.js and tractor.htm files from

anyone would help me please with this homework >>

Hands-On Project 4-1 In this project, youll continue working with the tuba.js and tractor.htm files from the chapter. Youll add error handling to the verifyCrops() function so users receive an error message if they remove checkmarks from all the crop boxes. . Use the file manager for your operating system to copy all the files and subfolders from the Chapter /Chapter directory in your Data Files, and paste them in the Chapter / HandsOnProject - folder. Verify that you still have a copy in the Chapter /Chapter directory. . In your text editor, open tuba.js from the Chapter /HandsOnProject - folder, and then in the comment section, replace the text Chapter case with Hands-on Project - . . Scroll down to the verifyCrops() function, and then delete the line testFormCompleteness(); so the command block is empty. . Enter the following try statement within the command block of the verifyCrops() function: 1 try { 2 for (var i = 0; i < 7; i++) { 3 if (cropsFieldset.getElementsByTagName("input")[i]. 4 checked) { 5 cropscomplete = true; 6 messageElement.innerHTML = ""; // clear previous 7 message or recommendation 8 testFormCompleteness(); 9 i = 8; 10 } 11 } 12 if (i === 7) { 13 throw "Please select at least one crop."; 14 } 15 } Note that the code shown in Steps and is not free of bugs. You will debug the code later in the next project.

. Below the try statement but before the closing } of the verifyCrops() function, add the following catch() statement: 1 catch(message) { 2 cropsComplete = false; 3 messageHeadElement.innerHTML = ""; // remove any former 4 recommendation heading 5 messageElement.innerHTML = message; // display error 6 message 7 } . Scroll to the top of the document, and then change the values for the variables acresComplete, cropsComplete, and monthsComplete to false. Note that the value for the fuelComplete variable should remain true. . Save your changes to tuba.js, and open tractor.htm in a browser, and then test the crops boxes by selecting some and then unselecting all of them. Notice that an error message is displayed when no crops boxes are checked, as shown in Figure - , and the message is removed when any crops box is checked.

. Close the tractor.htm file in your browser.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!