The value of the category field should appear in the short description field.

TanujB
Tera Contributor
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
var categoryValue = gForm.getValue('category');
    gForm.setValue('short_description', categoryValue);
}
I am using this code but this is not workable in client Scripting please help in this  
1 ACCEPTED SOLUTION

J Siva
Kilo Patron
Kilo Patron

Hi @TanujB 
It's g_form not gForm.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
var categoryValue = g_form.getValue('category');
    g_form.setValue('short_description', categoryValue);
}

Regards,
Siva

View solution in original post

4 REPLIES 4

J Siva
Kilo Patron
Kilo Patron

Hi @TanujB 
It's g_form not gForm.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
var categoryValue = g_form.getValue('category');
    g_form.setValue('short_description', categoryValue);
}

Regards,
Siva

GlideFather
Tera Patron

@TanujB 

 

it looks ok, try to clear the value in short description before you enter it there:

var categoryValue = gForm.getValue('category');
if (categoryValue) {
gForm.clearValue('short_description');
gForm.setValue('short_description', categoryValue);
}

 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


@TanujB oh and now I noticed..

what is gForm? shall it not be g_form? :)))

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Hi @TanujB I provided the same solution at the same time, could you please consider accepting as solution as well, please

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */