Skip to main content
Inspiring
August 30, 2020
Answered

Calculation to add checkbox values and drop-down value

  • August 30, 2020
  • 1 reply
  • 2328 views

Hi there!

 

I have a registration form when the user must select one of three check box options, each checkbox has a different export value. I also have one dropdown list with "yes" or "no" as options, "yes" needs to equal 0 and "no" needs to equal $45.00.

I have a text field where I want to calculate the checkbox option and add any "no"selection to it. 

I'm at a total loss and any help would be grealy appreciated.

 

Thanks!

This topic has been closed for replies.
Correct answer Jennifer5EAC

Hey Jennifer, 

 

Would you mind updating this thread.

 

Did the solution provided by NessaNurani resolved your issue?

 

Thank you.


Apologies for having not updated the thread sooner.

 

Yes, NessaNurani's solution worked beautifully! She was so gracious to further assist me via private message to better understand and learn how to replicate her solution myself, as I was having difficulty doing so.  She was able to help me identify where I was going wrong. 

 

A huge thanks to NessaNurani!

 

Cheers!

 

 

1 reply

ls_rbls
Community Expert
Community Expert
August 30, 2020

What exactly  is the role of the checkboxes?  You said you have three...what are the export values of each?

 

And what you're saying is, that when a user selects NO from the dropdown menu the texfield should take this string value plus the export value of whatever checkbox is checked?

 

 

Nesa Nurani
Community Expert
Community Expert
August 30, 2020

Try this:

var a = this.getField("checkbox1").value;
var b = this.getField("checkbox2").value;
var c = this.getField("checkbox3").value;
var x = this.getField("dropdown1").value;
if(a!="Off"){
event.value = a+x;}
else if(b!="Off"){
event.value = b+x;}
else if(c!="Off"){
event.value = c+x;}
else event.value = 0;

 

don't forget to add export values to yes and no in dropdown field.

Inspiring
August 30, 2020

Hi there, I uploaded the example I'm working with if that's helpful:)