Skip to main content
Beaded Kat
Participant
May 12, 2020
Question

Content of a field remain empty until another field has calculated

  • May 12, 2020
  • 1 reply
  • 344 views

I am working on a form for my teacher husband, where it will give a grade value depending on the numbers entered for each question when the paper is marked. I have the form so that as each question is marked, the total value adds up, then another field will give a grade letter depending on this calculation.

What currently happens is, the default visible grade is D, because the value is 0.  Is there a way to make the D vanish until the calculation is greater than 1?

I do hope that makes sense.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
May 13, 2020

Sure. I'm assuming you have a variable that holds the final grade (as a number), which you then convert to a letter.

You need to add the following to this if-else structure:

 

if (grade==0) event.value = "";

else if (grade==1) event.value = "D";

// etc.

 

PS. Shouldn't the lowest grade be an "F", or is that not done anymore?

Beaded Kat
Participant
May 13, 2020

Yes, there is a field with a variable in "total points", and another field, which generates a letter grade depending on "total points". There is no F grade now. I have it so that if the variable is between a certain number, it displays a different grade letter. So, what you are saying is... add this? 

if (total points==0) event.value = ""; 

Beaded Kat
Participant
May 13, 2020

I added
if (n < 1) {event.value = "";} to my original and it works beautifully. Thank you for your help.