Skip to main content
Participant
September 13, 2024
Answered

Check Box being selected from DB

  • September 13, 2024
  • 1 reply
  • 246 views

I have 2 check boxes 100% and another check box that says other with a text field.

 

I have database field called contribution amount.  How can I check the box if the DB value is 100

and when the DB value isnt 100 i want the other check box selected with the contribution amount to appear

 

i tried to do showif contribution !=100 but that didnt work  is there another way i can display it

This topic has been closed for replies.
Correct answer Nesa Nurani

Use this as custom calculation script of DB field (change field names to your actual field names):

var DB = Number(event.value);
//Check checkbox if value equal 100
this.getField("Check Box1").checkThisBox(0, DB === 100 ? true : false);

//Check 'Other' checkbox if value is not 100 and show amount in field called 'Show Amount'
if(DB && DB !== 100){
 this.getField("Other").checkThisBox(0,true);
 this.getField("Show Amount").value = DB;}
else{
 this.getField("Other").checkThisBox(0,false);
 this.getField("Show Amount").value = "";}

 

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
September 14, 2024

Use this as custom calculation script of DB field (change field names to your actual field names):

var DB = Number(event.value);
//Check checkbox if value equal 100
this.getField("Check Box1").checkThisBox(0, DB === 100 ? true : false);

//Check 'Other' checkbox if value is not 100 and show amount in field called 'Show Amount'
if(DB && DB !== 100){
 this.getField("Other").checkThisBox(0,true);
 this.getField("Show Amount").value = DB;}
else{
 this.getField("Other").checkThisBox(0,false);
 this.getField("Show Amount").value = "";}