Recommended Blocks
"Line Chart" inserts a javascript block with the setLineChartBlock routine to generate line chart into a canvas tag with the values passed as parameters:
setLineChartBlock(canvasId, data, config);
setLineChartBlock('canvasId', [{'dataset': 'First Dataset','color': 'red','values': {'label a': 10,'label b': 15,'label c': 30}},{'dataset': 'Second Dataset','color': 'blue','values': {'label a': 40,'label b': 20,'label c': 5}}],{'title': 'Line Chart'});
"Bar Chart" inserts a javascript block with the setBarChartBlock routine to generate bar chart into a canvas tag with the values passed as parameters:
setBarChartBlock(canvasId, values);
setBarChartBlock('canvasId', [{label: 'First item', value: 10, color: '#FF0000'},{label: 'Second item', value: 5, color: '#00FF00'},{label: 'Third item', value: 100, color: '#0000FF'}]);
"Ad Blocker Alert" displays a pop-up window if there is an Ad Blocker active in the browser, and limit the access to the page's content.
Message to display:
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 "Javascript Unserializer" inserts a javascript block with the unserialize routine:
unserialize(phptext);
unserialize('O:8:"stdClass":2:{s:5:"attr1";s:15:"First Attribute";s:5:"attr2";s:16:"Second Attribute";}');
Output would be a javascript object with the structure:
{attr1:"First Attribute", attr2:"Second Attribute"}
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;
})()
"Address Field" inserts an autocomplete address field integrated to Google Places.
Field type | Required field |
Name | |
Id attribute | |
Class attribute | |
Google api key | If you have no an api key, visit the Google Console, and generate one to your website's domain. |
Restrict the address to the countries |
It is possible select a maximum of 5 countries. |
"Read CSV File" inserts a javascript block with the readcsv routine for reading an online CSV file and generate a javascript array to be used in the form:
readcsv(args);
javascript object with the following properties:
Every row would be a columns array, or an object (if the headline property was passed as true).
populate_dropdown(selector, args): Populates a dropdown field with the CSV data. First parameter (selector), a valid jQuery selector to identify the dropdown field. Second parameter (args), plain object with two properties, "value": the column's name to use as values of the field's options, "text": the column's name to use for the texts of the field's options.
Example:
readcsv({'url':'http://www.websitedomain.com/file.csv', 'callback':populate_dropdown('[name="field_name"]', {'value':'column_a', 'text':'column_b'})});
populate_input(selector, args): Populates an input (or textarea) field with the CSV data. First parameter (selector), a valid jQuery selector to identify the dropdown field. Second parameter (args), is a plain object with the property, "value": the column's name for the field's value.
Example:
readcsv({'url':'http://www.websitedomain.com/file.csv', 'callback':populate_input('[name="field_name"]', {'value':'column_a'})});
Implementing your own callbacks:
readcsv({'url':'http://www.websitedomain.com/file.csv', 'filter':{'column_a':3,'column_b':'qwerty'}, 'callback':function(csv_data){/* Your code Here*/}});