setValue in select box in catalog client script

Hafsa1
Mega Sage

I have 2 region field with value as "NA" for "North America.

I am using catalog client script to fix value of first region into another and second one is read-only

But it is not updating. What wrong I'm doing?

var regions = g_form.getValue("u_region").toString();

I used g_form.setValue("u_region_1", regions );

 

10 REPLIES 10

dgarad
Tera Sage

Hi @Hafsa1 

Remove toString() method.

Hafsa1
Mega Sage
 var cont= g_form.getValue("specify_the_request");
   var regions = g_form.getValue("u_region");
   alert("Region is-"+regions );
   if(nature=="3"){
    alert("inside")
g_form.setValue("u_region_1",regions );
}
 
Output
Region is-NA
 
select box "u_region" and "u_region_1" both are having value as "NA" and text as "North America"

var value=g_form.getValue('selectboxName');

 var text=g_form.getOption('selectBoxName', value).text;

Hafsa1
Mega Sage

@dgarad I have to setvalue of "u_region_1" with same value as "u_region".

getOption is for getting value.