Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Returning a text value based on tally from radio buttons

New Here ,
Mar 06, 2021 Mar 06, 2021

I'm creating an assessment form that needs to provide an overall rating based on how many times a specific level is acheived in different areas.

 

I've created a number of radio groups (Group1, Group2, Group3, Group4, Group5, Group6, Group7, Group8) for each area with 5 choices (A,B,C,D,E) and created a tally counter (TallyA, TallyB, TallyC, TallyD, TallyE). The tally is working fine but I'm struggling with the next step and would be grateful of some help.

 

The scoring matrix is as follows:

  • ≥5 As = Excellent
  • ≥5 Bs = Very good
  • ≥5 Cs= Clear pass
  • ≥4 Ds = Borderline pass
  • ≥5 Ds = Borderline fail
  • ≥1 Es = Clear fail

 

I would like a text return of Excellent, Very Good, Clear Pass, Borderline Pass, Borderline Fail or Clear Fail based on the tally counts if this is possible. I have some limited experience with JavaScript and am willing to use this if required.

 

Any help would be gratefully received. Thanks in advance.

TOPICS
JavaScript , PDF forms
735
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Mar 15, 2021 Mar 15, 2021
LATEST

Just in case your conditions don't cover all possible situations I would add a default value to the end of your code.

Something like this:

 

else event.value = "";

 

If you don't do that, the last applied value will remain, even if it's no longer valid at all.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2021 Mar 06, 2021

So TallyA shows number of "A" choices, TallyB number of "B" choices?

Each Tally will have it's own field to show text?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2021 Mar 06, 2021

It's possible, but your scoring matrix is incomplete.

For example, there could be a scenario where there's both an E and more than 5 A's... What should the score be then? Does the E override the A's, or the other way around?

Also, there could be a scenario where none of these conditions are true (eg. 3 A's, 3 B's, 2 C's). What's the score then?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 15, 2021 Mar 15, 2021

Thank you for your responses. I've managed to come up with the following which broadly seems to work:

 

var TallyA = this.getField("TallyA").value;
var TallyB = this.getField("TallyB").value;
var TallyC = this.getField("TallyC").value;
var TallyD = this.getField("TallyD").value;
var TallyE = this.getField("TallyE").value;
var OverallTally = this.getField("OverallTally").value;

 

if( OverallTally < 8 ) {
event.value = "Please complete all 8 elements to grade";
}
else if( OverallTally < 7 ) {
event.value = "Learning objectives achieved";
}
else if( TallyE > 0 ) {
event.value = "Requires further remediation";
}
else if( TallyD > 4 ) {
event.value = "Same day remediation";
}
else if( TallyD > 3 ) {
event.value = "Learning objectives achieved";
}
else if( TallyC > 4 ) {
event.value = "Learning objectives clearly achieved";
}
else if( TallyB > 4 ) {
event.value = "Very good overall performance";
}
else if( TallyA > 4 ) {
event.value = "Excellent overall performance";
}

I've adjusted the matrix so each element is weighted to create score bands to complete the scoring system and am aiming to adjust the above to display the result in one field. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 15, 2021 Mar 15, 2021
LATEST

Just in case your conditions don't cover all possible situations I would add a default value to the end of your code.

Something like this:

 

else event.value = "";

 

If you don't do that, the last applied value will remain, even if it's no longer valid at all.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines