- 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:26 PM
Hi,
What is not working here?
Are you printing result in alert?
function onSubmit() {
var txt = ('u_internal_unit');
var numb = txt.match(/\d/g);
numb = numb.join("");
alert(numb); // numb contains number here
var ans = ('iui_amount');
ans = (numb); //
}
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2022 07:27 PM
Hi
Please try the code provided below:
function onSubmit() {
var txt = ('u_internal_unit'),
numb = text.match(/(\d+)/g),
numb = numb.join(',');
//Not sure what is the purpose of below line??
var ans = ('iui_amount');
ans = (numb);
}
Please mark my answer as correct if this solves your issues!
If it helped you in any way then please mark helpful!
Thanks and regards,
Kartik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2022 07:32 PM
Unfortunately it is giving me an error;
onSubmit script error: ReferenceError: text is not defined:
function () { [native code] }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2022 07:52 PM
Hi
My apologies!
I did a typo! Instead of txt I wrote text.
function onSubmit() {
var txt = ('u_internal_unit'),
numb = txt.match(/(\d+)/g),
numb = numb.join(',');
//Not sure what is the purpose of below line??
var ans = ('iui_amount');
ans = (numb);
}