yes or no

Basina Akash
Tera Contributor

How to auto populate  yes or no question type based on another variable by using client script 

10 REPLIES 10

Amit Verma
Kilo Patron
Kilo Patron

Hi @Basina Akash 

 

You can write an On-Change client script which can make the value of your first field to Yes or No based on the change of value in your second field. Below is a sample code and snip of the client script for your reference :

 

AmitVerma_0-1703745338152.png

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }

   //Type appropriate comment here, and begin script below
	// Assuming write_yes_or_no is a text field on change of which Yes or No dropdown value should change
	var yesOrNo = g_form.getValue('write_yes_or_no');
	yesOrNo = yesOrNo.toLowerCase();
	if(yesOrNo == "yes"){
		g_form.setValue('yesorno','Yes');
	}
	else if(yesOrNo == "no"){
		g_form.setValue('yesorno','No');
	}
   
}

 

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.