- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2022 06:13 PM
Hi everyone, hope you're having a nice day.
I have a field for a string with a number (Eg. Box of 100)
I want to be able to extract the number from the string (100) and move that field to another field to be used in another string field.
I've made a client script like this but it does not seem to be working in the way that is intended, any help would be much appreciated 🙂
function onSubmit() {
var txt = ('u_internal_unit');
var numb = txt.match(/\d/g);
numb = numb.join("");
var ans = ('iui_amount');
ans = (numb);
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2022 07:38 PM
g_form.getValue('<field name>') will get the value of the field.
g_form.setValue('<field name>', <value>) will set the value to the field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2022 07:36 PM
Hi Aeden,
Try below. To get the value of a field, use g_form.getValue(),
function onSubmit() {
var txt = g_form.getValue('u_internal_unit');
var numb = txt.match(/\d/g);
numb = numb.join("");
ans = g_form.setValue('iui_amount', numb);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2022 07:38 PM
g_form.getValue('<field name>') will get the value of the field.
g_form.setValue('<field name>', <value>) will set the value to the field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2022 07:43 PM
Working perfectly! Finished code is as follows
function onSubmit() {
var txt = g_form.getValue('u_internal_unit');
var numb = txt.match(/\d/g);
numb = numb.join("");
var ans = ('u_iui_amount');
ans = (numb);
g_form.setValue('u_iui_amount', ans)
}