Edit Row of Multi-Row Variable Set triggering "On Change" catalog client script

SuneelG
Kilo Guru

I have a MRVS with 3 variables, one Select Box and two Single Line Text. The Select Box has 2multiple choices and also configured to include "None".

Created a catalog client script (On Change) that will set the values of two Single Line Text fields based on the selection from Select Box.

The defaults values populated by on change client script can be modified before adding the row data.

The problem I am facing is that when I try to edit the row, it is triggering "On Change" client script and setting the values of the two single line text fields to default value and causing the modification to the default value (I made when I added the row for the first time) to revert back. 

Just for test I added an alert in the "On Change" client script and I could see the alert message immediately when I click on edit icon, before even displaying the mrvs form. Once I click "Ok", the form appears and the values are set to default values.

Why "On Change" client script is getting triggered before even making the mrvs form visible (i.e .. no change to the value of Select Box variable)?

If this is the default behavior (ideally it should not be), Is there any way to fix this?

 

Thanks in advance.

Suneel

5 REPLIES 5

Brad Bowman
Kilo Patron
Kilo Patron

Hi Suneel,

I tried to replicate this in my PDI, putting the onChange CCS within the MRVS, when the Select Box variable changes.  So when I add a new row, I get the alert when I set the value of the Select Box, as expected.  When I edit an existing row, nothing happens until I change the value of the Select Box variable - then I get the alert as expected.  Do you have any onLoad scripts running on the MRVS, or any other onChange scripts?

Hi Brad,

Any idea how to identify whether the OnChange client script is running when I am creating a new row or editing an existing row. I have a use case where I need to set a field within the mrvs with the total no. of rows.

For example currently there are 2 rows .... onChange client script will show length as 2 .... but if I am creating a new record I should populate the value as 3 as I am about to create the 3rd record. if I am editing an existing record I should update it as 2 only. ANy idea how to achieve this? I do not want to create extra variable to store whether it is edited or not as in the grid view I cannot hide that

SuneelG
Kilo Guru

Hi Brad,

 

Thanks for the quick response.

I have "On Load" script that will set the options for a different "Select Box" (not the one for which I created  on change script which i discussed in my post) variable based on the selection from a variable in parent form (not in mrvs)

 

I have one more "On Change" for a different "Select Box" field and that will update options of another select box variable. Note:- both there variable not part of the above variable mentioned in my post

 

In total I have 3 scripts (2 "On Change" and  1"On Load") and variables are not same in each one.

 

Thanks,

Suneel

SuneelG
Kilo Guru

Any pointers??