- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
Hi All,
I have a catalog item where there are 2 variables - article_name and article_name2.
article_name2 is a read only variable (single line text)
article_name is a single line text variable.
When the users fills in the article_name variable, I want the system to automatically populate article_name2 with the same information.
I have tried the following as a catalog client script, but it doesn't populate the field:
function onSubmit() {
var articleName = g_form.getValue('article_name');
if (articleName) {
// Set the value of the variable
g_form.setValue('article_name2', articleName);
}
return true;
}Is anyone able to help me achieve this?
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday - last edited Tuesday
Hi,
I would start by changing the logic to happen as an onChange Client script (have it interact on change of the first variable article_name).
Then the user can see the results before the form is submitted.
and in the script you would only need to do the setValue-part, and use the newValue input as basis, like this:
g_form.setValue('article_name2', newValue);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday - last edited Tuesday
Hello @Cat
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
//Type appropriate comment here, and begin script below
g_form.setValue('article_name_readonly',newValue);
}
If my response has helped you, hit the helpful button, and if your concern is solved, do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
