- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2024 07:44 AM
Hi,
I have a float type field A. I want to set the value by A's value/100 when submit. below code is not working in portal.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2024 08:48 AM - edited 07-05-2024 08:48 AM
Hi Rosy,
Is this working in next experience / native view?
Change the UI Type field to ALL
Try the script below
var value = parseFloat(g_form.getValue('u_duty_percentage')/100);
g_form.setValue('u_duty_percentage', value.toFixed(2));
Curious, why don't you use this in on change client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2024 08:15 AM
Hi @Rosy14,
please check below script:
function onSubmit() {
var x = g_form.getValue("u_duty_percentage");
if (x) { // Ensure x is not null or empty
x = parseFloat(x) / 100; // Convert to float and divide by 100
g_form.setValue("u_duty_percentage", x);
}
return true; // Ensure form submission continues
}
Thank you, please make helpful if you accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2024 08:48 AM - edited 07-05-2024 08:48 AM
Hi Rosy,
Is this working in next experience / native view?
Change the UI Type field to ALL
Try the script below
var value = parseFloat(g_form.getValue('u_duty_percentage')/100);
g_form.setValue('u_duty_percentage', value.toFixed(2));
Curious, why don't you use this in on change client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2024 08:50 AM
If I use onchang its giving stack overflow error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2024 08:52 AM
How about a BR instead then?
on submit client script would make sense if it was a catalog, for a general record I'm not too sure.