Form Tools Blocks
"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. |
"Print Form" inserts a javascript block with the printForm routine for printing the form only without other page's area:
printForm(selector);
printForm("#cp_calculatedfieldsf_pform_1");
"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*/}});