Client Script Can Not Set Reference Field Value To Empty String In Portal

Toren
Kilo Guru

Hello Internet!

I am hoping to get some help from you regarding an issue that I am having.

My current version is Helsinki and unfortunately, I can not update to a never version.

I am currently working with the out of the box form widget in portal and I am trying to set a reference field to empty under certain conditions. In order to achieve this, I am doing the typical g_form.setValue('field_name', ''); 

However, this his method does not work for reference fields on the portal form widget. If I try to set any other field type to an empty string, it works just fine. If I try to set a reference field equal to any value that is not an empty string, it works just fine.

The error it is sending me is "scope.field.display_value_list is not defined".

Any advice is greatly appreciated! ❤️

4 REPLIES 4

Balaji Jagannat
Kilo Guru

Can you try g_form.clearValue(field_name);

Hey Balaji!

 

Sorry for the late response. I tried g_form.clearValue(field_name); and it sent me the same error.

Sumanth16
Kilo Patron

Hi ,

 

Use setTimeout function in script.

 

 setTimeout(function() {
g_form.setValue('your field name',';);
}, 0);

 

Please mark it as helpful if it helps.

 

Thanks,

Sumanth

Hi Sumanth!

I gave this a try and unfortunately is still gives me the same error.