Here is the link to the code a student is using:
We can’t get the function to run properly and update the response text area. I’m pretty new to this program as a teacher (my experience is in SQL and HTML). Can someone please help?
Thanks
Christine
First of all, the project link is not working. Please share the correct link. Secondly, also please confirm that this is not a part of the Create PT. As per college board guidelines, teachers cannot help students on the Create PT.
This is not part of the create PT. I know I’m not allowed to hep with that. This is for the Decision Maker App in Unit 4.
Also, the link works when I use it, so I’m not sure how I’m entering it wrong. I’m just clicking the share button from the page and copying the link. This is the code:
var dessert;
var budget;
// where the person can eat based on budget
onEvent(“budgetdropdown”, “click”, function( ) {
budget = getText(“budgetdropdown”);
checkCombos();
});
//where the person can eat based on dessert chosen
//function
function checkCombos() {
if (budget >= “8” && dessert == “Ice Cream”) {
setText(“responsehtextarea”, “Leatherbys!”);
} else if (budget >= “8” && dessert == “Drinks”) {
setText(“responsehtextarea”, “Sweet Tea Boba Shop!”);
} else if (budget >= “8” && dessert == “Pastries/Miscellaneous”) {
setText(“responsehtextarea”, “Rick’s Dessert Diner!”);
} else if (budget<=“7” && dessert == “Ice Cream”) {
setText(“responsehtextarea”, “Dairy Queen!”);
} else if (budget<=“7” && dessert == “Drinks”) {
setText(“responsehtextarea”, “Dutch Bros!”);
} else {
setText(“responsehtextarea”, “Snooks Candies!”);
}
}
This is the error I am getting when I click on the link. So I am not able to access your app.
I recreated an app and used your code. I made a few changes to your code. Please check it out here.
1 Like
Thank you so much! I appreciate your help