The CreatorCon Call for Content is officially open! Get started here.

Clear value on reference field

sowmyarajaram
Kilo Guru

Hello All,

I have reference field by name field1 and 2 other fields by name field2 and field3. The values on field2, field3 are based on the reference field1. what I'm trying to achieve is if I have a value on field1 as xxxx, it sets field2, field3. later when I try to edit value on reference field1 to something else, i want the fields2, field3 to show no data on it (while i'm trying to change value on field1) 

Field1 = reference field

Field2, Field 3 = text field

 

Any help?

 

Sowmya

10 REPLIES 10

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

You probably have a script on change of field 1 that adds data on field 2 AND 3

On that script the first check would be 

if(isLoading || newValue=='')

return;

 

You have to modify this part to

if(newValue=='')

{

g_form.clearValue('<field 2>');

g_form.clearValue('<field 3>');

}

if(isLoading)

return;

 

-Anurag

-Anurag

Hello Anurag,

 

This is what I already have in place. the problem is I have selected a value on vendor field and now based on my onchange script, data has been populated on my below 2fields. However if i start editing the reference field or just remove the data on reference field and do not make any click on the form, the data would still be there with the below 2 fields. So as soon as user try to edit the reference field or type looking for new field, data should be cleared on below fields. Hope you are getting me.

 

find_real_file.png

That is just how on change works...When you type something and move the focus out of the form that is when on change triggers, there is nothing you can do to change this.

-Anurag

Thanks for the input.. now i'm clear, there is no other way.