- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2020 06:26 AM
Hello, community,
I have Multi-Row Variable Set and I need to check if one of the values has been already selected onChange of the value inside the MVRS. I'm trying to use Catalog Client Script for that – but firstly – I'm facing the issue that I cannot reach the already inserted values using g_form to compare it with newValue.
Does somebody know how to get to that values?
Thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2020 12:55 AM
I solved it by myself – but I'd like to share the solution with you.
1. Create a Catalog Client Script related to the Catalog Item with this content (onLoad):
//save rows from MRVS into some global variable
GLOBAL_VAR = {g_form: g_form}
2. Create another Catalog Client Script related to a variable set which takes the data from the global variable (onChange):
//take the rows from global variable
var data = GLOBAL_VAR.g_form.getValue("mrvs_name");
//parse it!
var object = JSON.parse(data);
Now you can easily access to the data in MVRS and compare it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2020 06:44 AM
See this article for some things I've been able to do with MRVS scripting. Part of this sounds like what you might be trying to do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2020 12:55 AM
I solved it by myself – but I'd like to share the solution with you.
1. Create a Catalog Client Script related to the Catalog Item with this content (onLoad):
//save rows from MRVS into some global variable
GLOBAL_VAR = {g_form: g_form}
2. Create another Catalog Client Script related to a variable set which takes the data from the global variable (onChange):
//take the rows from global variable
var data = GLOBAL_VAR.g_form.getValue("mrvs_name");
//parse it!
var object = JSON.parse(data);
Now you can easily access to the data in MVRS and compare it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2021 10:51 PM
Can you please show it by some examples if possible.
Like with some dummy variables etc

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2020 10:32 PM
Even though this question has already been answered, another way to prevent duplicate entries in multi-row variable set is to create a script in multi-row variable set instead of in the form's catalog client script. This has an additional advantage of being able to detect duplicate when the user tried to add the row in the multi-row variable set instead of having to wait until the user submits the form.
Further information available in the thread below.