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

How to Auto populate currency symbol's from one Field to another field

sujip
Kilo Contributor

Hi All,

If user select any of the currency symbol for the field "Budget Amount " then automatically the fields which are marked in blue colour should change the currency symbols

(for eg : If we change Dollar to CHF then automatically the other three fields currency symbol should change to CHF )

find_real_file.png

3 REPLIES 3

Vignesh21
Kilo Guru

Hi Suji,

 

For Budget Amount field have an onchange client script as below.

 var val = newValue.split(';');
	
	var symbol = '';
	var currency = val[0];
	var amount = val[1];
	
	if(currency == 'USD'){

		symbol = '$';

	}else if (currency == 'CHF'){

		symbol ='CHF';

	}else if(currency =='GBP'){
		
		symbol ='£';

	}else if(currency =='JPY'){
		
		symbol ='Â¥';

	}else if(currency =='EUR'){
		
		symbol ='€';

	}
	g_form.setValue('u_populate_from_currency',symbol+amount); 

 

Please let me know if you have any questions.

sujip
Kilo Contributor

Hi Vignesh,

I have tried with the above script which u suggested. When i modify currency symbol for budget amount, the other field currency changing but after saving the record. The other fields are showing only $ symbol its not changing currency symbol

sdeo
Kilo Contributor

Hi @sujip 

If your fields are of type 'Price', you can write a BR that run whenever the currency is modified.
The script can use two function calls: 

current.<field_name>.getCurrencyCode() <--- this gives you the denomination part like $ and so on
current.<field_name>.getCurrencyValue() <-- this gives you the amount part



once you have this data, you can set your target field value:

current.setDisplayValue('<target_field>',current.<field_name>.getCurrencyCode()+';'+current.<field_name>.getCurrencyValue());

This should do the trick!
Let me know if that worked for you.

Swapnil