Exchange Rate Blocks
The block includes the xe_fixerio_exchange_rates operation whose parameter is a plain object with the following properties:
xe_fixerio_exchange_rates({'from': 'USD', 'to': 'EUR', 'field': '[id*="fieldname'+'1_"]'});
A specific example: Assuming there is a field in the form that calculate a service price in United State Dollars (USD), the fieldname1, and you want get the price in Euros (EUR), furthermore there is a hidde field for the exchange rate, the fieldname2. The equation to associate with the calculated field to calculate the price in Euros would be:
(function(){
xe_fixerio_exchange_rates({'from': 'USD', 'to': 'EUR', 'field': '[id*="fieldname'+'2_"]'});
return fieldname1*fieldname2;
})()
If there is a dropdown field for selecting the currency code, the fieldname3, the equation would be:
(function(){
xe_fixerio_exchange_rates({'from': 'USD', 'to': fieldname3, 'field': '[id*="fieldname'+'2_"]'});
return fieldname1*fieldname2;
})()
The block reads the exchange rates from the Currency Converter API website
The block includes the xe_open_exchange_rates operation whose parameter is a plain object with the following properties:
xe_open_exchange_rates({'from': 'USD', 'to': 'EUR', 'field': '[id*="fieldname'+'1_"]'});
A specific example: Assuming there is a field in the form that calculate a service price in United State Dollars (USD), the fieldname1, and you want get the price in Euros (EUR), furthermore there is a hidde field for the exchange rate, the fieldname2. The equation to associate with the calculated field to calculate the price in Euros would be:
(function(){
xe_open_exchange_rates({'from': 'USD', 'to': 'EUR', 'field': '[id*="fieldname'+'2_"]'});
return fieldname1*fieldname2;
})()
If there is a dropdown field for selecting the currency code, the fieldname3, the equation would be:
(function(){
xe_open_exchange_rates({'from': 'USD', 'to': fieldname3, 'field': '[id*="fieldname'+'2_"]'});
return fieldname1*fieldname2;
})()