- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2015 07:09 AM
On my record producer, the string "undefined" appears upon opening the form. It is not defined as a default value, the "type" is a multi line text and is mapped to the field on the table. Can anyone suggest why this string is there and how get rid of it?
Solved! Go to Solution.
- Labels:
-
Personal Developer Instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2015 11:01 AM
Hi Eric,
Try the following...
if (shipping_special_instructions && shipping_special_instructions != ''){
g_form.setValue('u_shipping_special_instructions',shipping_special_instructions);
}
Thanks,
Berny

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2015 07:12 AM
Does the variable have a default value defined? If so, what is it? If not, do you have a client script populating the default value?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2015 07:35 AM
Hi Eric,
Just make sure that whenever your're assigning a value to this field you first validate that the variable is valid and does contain a value on it.
For instance, something like the following:
function onLoad() {
var incredible;
if (incredible && incredible != ''){
g_form.setValue('myVariable', incredible);
}
}
if i miss adding the first validation to check if the variable is initialized, then I will get the undefined value on the field:
function onLoad()
var incredible;
if (incredible != ''){
g_form.setValue('myVariable', incredible); // myVariable will be set to Undefined since the variable incredible was never initialized
}
}
I hope this helps!
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2015 10:36 AM
Thanks for the suggestions and pointing me one direction. I checked the default values on the record producer and table, nothing listed there. Also checked the client scripts. There is only 1 client script with that field name listed and that is pulling values from another table on the condition of a UI action.
In this case, I am opening the record producer form, and the form should be blank (including this field) and "undefined" is in the field. If this makes a difference, in the table, the field is a string with a size limit of 500 and in it is mapped in the record producer as a multiple line text. When the record producer form is opened this field should be empty.
This was the only client script that I have with the field. Any additional thoughts would be appreciated and Happy New Years to everyone.
function onChange() {
//control, oldValue, newValue, isLoading
var inventory = g_form.getReference('u_inventory_search');
var shipping_special_instructions = inventory.u_shipping_special_instructions;
g_form.setValue('u_shipping_special_instructions',shipping_special_instructions);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2015 11:01 AM
Hi Eric,
Try the following...
if (shipping_special_instructions && shipping_special_instructions != ''){
g_form.setValue('u_shipping_special_instructions',shipping_special_instructions);
}
Thanks,
Berny