How do I refer to variables in variable sets in a client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2014 01:48 PM
I have a variable which is the only variable in a variable set. I am trying to modify this variable using a client script (g_form.setValue()) but it isn't working. I have another variable which is not in a variable set and that one can be set through g_form.setValue() in a client script. Currently I am referring to the variable in the set like this: g_form.setValue('<variable>','<value>','<display>') but I have also tried g_form.setValue('<variable set>.<variable>','<value>','<display>') and g_form.setValue('variables.<variable>','<value>','<display>') but none of these works. What is the proper syntax for this reference?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2014 03:54 PM
It shouldn't matter if the variable is part of a set or if it is stand alone. g_form.setValue() will work against either.
The proper way is:
g_form.setValue('variable','value'); You can specifiy a third paramater (display value) however you probably don't need to. Try it without.
What is the variable type that is part of a set, that is not working for you?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2014 04:05 PM
The variable is a select box, and I am feeding g_form.setValue() valid values. Does it matter if the client script is running against the catalog item or the variable set? I have tried both but I've probably missed some combination of things to get it just right.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2014 04:15 PM
Paste your script here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2014 08:20 AM
function onSubmit() {
//Type appropriate comment here, and begin script below
alert('SCRIPT EXECUTING');
g_form.setValue('action.action', 'remove_access', 'remove access');
}
I have since changed the variable type to single line text but it still isn't working. The script applies to the catalog item and it is executing (according to the alert) when expected. The value of action is still not being assigned. I have tried both action and action.action (action is the name of both the variable set and the variable)