The CreatorCon Call for Content is officially open! Get started here.

Prepopulate a Text On Description Field Based Choice field value selection

APV Babu
Tera Contributor

I have one requirement, I need to Display multiple text sentences based on choice field value selection, How can I achieve this requirement

 

!!Thanks in advance.

 

 

 

Regards,

APV Babu

1 ACCEPTED SOLUTION

Hi @APV Babu ,

 

Please find the below code . You need to create an onChange client script

 

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

  var taskTemplateName = g_form.getValue('task_template_name');

  var descriptionField = 'description'; // Change this to the correct field name

  switch (taskTemplateName) {

    case 'Plan Direction':

      g_form.setValue(descriptionField, 'Plan direction/approval of the proposed correction method in writing');

      break;

    case 'Population':

      g_form.setValue(descriptionField, 'Population and additional data points necessary for executing the correction.');

      break;

    case 'Responsible Party':

      g_form.setValue(descriptionField, 'Confirmation from the group responsible for the correction in writing');

      break;

    case 'Funding':

      g_form.setValue(descriptionField, 'Location of the funding for the correction');

      break;

    case 'Spreadsheet':

      g_form.setValue(descriptionField, 'The Adjustment Consultant Spreadsheet that captures the correction process in writing.');

      break;

    case 'Additional Info':

      g_form.setValue(descriptionField, 'Additional information is needed in order to process the requested correction.');

      break;

    default:

      g_form.setValue(descriptionField, ''); // Clear the description if no match is found

  }

}
}

 

Thanks,

Danish

 

View solution in original post

6 REPLIES 6

@APV Babu , Your Welcome:)

 

Happy Learning!:)

 

 

Samaksh Wani
Giga Sage

Hello @APV Babu 

 

You need to write a onChange Client Script :-

 

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

  var choice=g_form.getValue('choice_field_name');
  var res=choice +'\n';
  g_form.setValue('description',res);


}

 

Plz mark my solution as Accept, If you find it helpful.

 

Regards,

Samaksh