- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2017 04:18 PM
Have variable in my record producer with Field name, u_testchoice, which is a select box with values ("none", "value1","value2",and "value3").
When the user sets that u_testchoice field value to "value2", I want my client script to set the record producer field named u_teststring to "Yahoo".
Here is my code, which seems to do nothing.
function onChange(control, oldValue, newValue, isLoading) {
if ( newValue == ' ') {
return;
}
//Type appropriate comment here, and begin script below
if (producer.u_testchoice == 'value2'){
g_form.setValue('u_teststring','Yahoo'); }
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2017 09:20 PM
It does work for me
//tested
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
alert('load');
g_form.clearValue('test_string');
var choice = g_form.getValue('u_testchoice');
alert(choice);
if (choice == 'value_2') // value_2 is the value of the choice
{
alert('inside');
g_form.setValue('test_string','Yahoo');
}
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2017 05:23 PM
var choice = g_form.getValue(u_testchoice));
if (choice == 'bla'){
action
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2017 05:29 PM
Hello,
In catalog client script use g_form.getValue('variale_name') to get the value from the variable and then set it accordingly using g_form.setValue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2017 05:33 PM
Hello Strout,
can you please check it
var choice = g_form.getValue('producer.u_testchoice');
if ( choice == 'value2')
{
g_form.setValue('u_teststring','Yahoo'); }
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2017 07:55 PM
Not working, here is the current code:
function onChange(control, oldValue, newValue, isLoading) {
if ( newValue == '') {
return;
}
var choice = g_form.getValue('u_testchoice');
if (choice == 'value2') {
g_form.setValue('u_teststring','Yahoo');
}
}
Also tried:
Variation 1) var choice = g_form.getValue('producer.u_testchoice');
Variation 2) newValue == 'DOG'
Variation 3) g_form.setValue('producer.u_teststring','Yahoo');
I am wondering of the fact that the u_testchoice is a choice and the u_teststring is a "single Line Text" would matter?