Skip to main content
Participant
December 15, 2021
Question

yes/no choice results in field populating either "1" for a yes selection or a copy of another field

  • December 15, 2021
  • 2 replies
  • 323 views

Hi,

Looking for advice on setting up a form to fill out one field based on a previous yes/no choice (either radio button or drop down), where yes= an export value of 1, and a no = a previously calculated value from another field.

 

Overall Score = numeric tally equaling a 1,2,3,4, or 5

Answer Question = yes or no (yes=1, no=same value as Final Score)

Final Score = either 1 (reflecting the above choice of yes) or 1,2,3,4, or 5 (reflecting the above choice of no=same value as Overall Score)

 

Example A:

Overall Score = 4

Answer Question = yes

Final Score = 1

 

Example B:

Overall Score = 4

Answer Question = no

Final Score 4

 

I hope this question makes sense! I feel like there is something in the export value for the Yes selection, but I can't figure out the No selection!

 

Thank you!

This topic has been closed for replies.

2 replies

Nesa Nurani
Community Expert
Community Expert
December 15, 2021

You can give radio buttons export values of "yes" and "no" then

as 'custom calculation script' of Final Score field try this:

var f = this.getField("Form Field #1").value;
var r = this.getField("Form Field #2").valueAsString;
if(r == "yes")
event.value = 1;
else if(r == "no")
event.value = f;
else event.value = "";

reninnnAuthor
Participant
December 15, 2021

Clarifier - 

 

Form Field #1 is the Overall Score = numeric tally equaling a 1,2,3,4, or 5

Form Field #2 is a radio or drop down selection; Answer Question = yes or no (yes=1, no=same value as Final Score)

Form Field #3 is an auto-filled field based on previous fieldsl Final Score = either 1 (reflecting the above choice of yes) or 1,2,3,4, or 5 (reflecting the above choice of no=same value as Overall Score)