- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 03:19 AM
Hi all,
I have a requirement, a description field and quantity field, if on change of quantity , append both field description and quantity and set the value in another field 'C', then clear the value of description field and quantity field, if again on change of quantity , append both field description and quantity and add the value in Variable 'C'.
In my case, while i am setting the value in Variable 'C', each time field is clearing and setting new Value
Is there a way to add the values in the field??
Thanks in advance.
Regards,
Suvedha
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 05:21 AM
Hi @Suvedha ,
modify this script is c field value is nill then add directly else append with existing . something like below code:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var description = g_form.getDisplayValue('description');
var qunatity= g_form.getDisplayValue('quantity');
var c_fieldValue = '';
if( g_form.getDisplayValue('c_field_name') == ''){
c_fieldValue = description + qunatity;
}
else{
c_fieldValue = g_form.getDisplayValue('c_field_name') + "\n\n" + description + qunatity;
}
alert(c_fieldValue );
g_form.setValue("v",c_fieldValue );
g_form.clearValue('description');
g_form.clearValue('quantity');
}
Regards,
Riya Verma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 05:39 AM
Hello @Suvedha
Please find updated script below:
Thank you,
Ali

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 03:26 AM - edited 06-20-2023 03:30 AM
You can first read value of the variable C before setting new value and then set both old and new value in the variable by concatenating both the values.
Ex:
Assume you have new value in variable newVal
var existingValue = g_form.getValue("VARIABLE_C");
g_form.setValue("VARIABLE_C", existingValue + "\n\n" + newVal);
Can you post the script which you have written? it will be easier to suggest changes there.
Thanks,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 03:41 AM
Hi Ahmmed,
Thanks for your reply.
Please find the script which i have written,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 05:39 AM
Hello @Suvedha
Please find updated script below:
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 04:16 AM
Hi Ali,
This got fixed. Thank you for your reply
But one thing, while populating the first line is taking line break.
can we do any thing for that?