- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 03:45 PM
Hi Team,
I want to copy the contents from one field (String1) and duplicate it on another field (String2) as the default value. Users with access to edit can edit the (String2) field. But by default, (String1) should be the same as (String2).
String1 - u_os_host_name
String2 - u_inventory_name
They are both in the same table / form.
All help is appreciated.
Thank you
Regards
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 03:51 PM
Hi,
You can do this a couple ways. The first is with an onChange client script to set the value if none already exists. For example:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue === '') {
return;
}
if (g_form.getValue('u_field2') != '') {
return; // a value already exists. do not overwrite
}
// Copy the value from u_field1 to u_field2
g_form.setValue('u_field2', g_form.getValue('u_field1'));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 04:22 PM
Hi Chuck,
Can i use OncellEdit?