Make an order guide variable "ReadOnly" on "choose options" tab

Dacki
Tera Expert

Hi,

I have a field "Beneficiary" on an order guide .   This field is populated   on the order guide form.

I wrote a catalog client script to make it readonly   on the first tab .

When   I go back   by clicking   on     " describe needs" button, I want     the beneficaiary field can be editable.

My catalog client script is :

function onLoad() {

        if (g_form.getParameter('sysparm_active')!='') {

      // this stuff only runs if catalog item is viewed in Order Guide

      g_form.setReadOnly('Myvariable',true);

  }

 

}

So   I want   that when I am on "describe needs"   tab   the   "beneficiary" field to be readonly   but   not   on "choose options"   tab.

Thanks you in advance for you help !

Arnaud

6 REPLIES 6

miked_jones
Giga Expert

You could try something like this in an onload catalog client script (assuming this is on a variable set?).



var thisGuide = $("sysparm_guide").value;


var thisItem = $("current_item").value;



if(thisGuide == thisItem) {


g_form.setReadOnly('Myvariable', true);


}



This should make the variable read-only as the order guide loads (or if you navigate back to the Describe Needs screen) but would take no action when a catalog item is loaded (when you click choose options).


Dacki
Tera Expert

Hi ,



Thanks you so munch for your answer.   It works.



I tried the   catalog client script   and it works as bellow :



1.   When I am on   "Describe   needs"   tab     the " beneficiary" field is   ReadOnly.  


2.   But when I am   on "choose option"   tab     the " beneficiary" field is   not   ReadOnly.



Could you tell   me   how to do the opposite   ?     That is finaly   the   request of   the customer .



Many Thanks


Hi.You should write the catalog client script for the Catalog Item present in the Choose Options tab.


Some thing like onLoad :


g_form.setReadOnly('Myvariable', true);


athimar
Giga Contributor

Did you get a response for this?  I'm currently looking to do the same - make it read only on the options page.