API: Store Form Data & Text Offline

Save form data or other text to a .csv or .txt file stored locally in Kiosk Pro's Documents folder.

Resulting files can be accessed directly on the device by a locally stored HTML page, manually transferred to a computer, or retrieved remotely through Dropbox Sync. Files can also be managed using the Manage Local Files API.

Requirements

Kiosk Pro Basic, Plus and Enterprise

  • Integration of our JavaScript API into your webpage
    • Sample code to run within the app and download for integration into your own project is available here.
    • Best practices for working with the JavaScript API are available here.
  • App Settings
    • Content > JavaScript API > Access JavaScript API = By Import
  • Storage of resulting data in Kiosk Pro's Documents folder
    • Due to sandboxing in iOS/iPadOS, Kiosk Pro is unable to store local files outside of its own Documents folder. 


Triggers via API Functions

Save Data to Local File

This function saves data to a file stored locally in Kiosk Pro's documents folder.

The filepath defined as a parameter to this call is relative to the main Kiosk Pro Documents folder (not the page calling the function if that page is also stored locally). If the file exists, Kiosk Pro will add data to the existing file in a new line. Otherwise, a new file will be created.

CSV (comma-separated value) is a standard format compatible with most spreadsheet software, including Microsoft Excel, and is often used as a format for uploading contact data to online databases. When using this format, each cell within a line must be delineated by a comma. Entries can also be saved to a plain text (.txt) file.

Kiosk Pro saves the contents of each function call as a new line in the file. If you need to enter multiple lines of data in a single call, the strings can be separated by 'LF', which will manually start a new row.

More information on how to sync the resulting .csv file remotely back to a Dropbox account if you are using our Plus or Enterprise versions is available here.

Format
writeToFile(fileName, fileData, callback);
		
Parameters
  • fileName - [string] the name of the .csv or .txt file saved to the device as a string, which should include the suffix '.csv' or '.txt'
  • fileData - [string] the data that is being saved
  • callback - [string] the name of the callback to be triggered after the function has been executed
Callback format
callback(success);
		
Callback return values success - if defined, the function successfully wrote data to the local file named


Sample Code

  • This sample code relies on the JavaScript APIs built into Kiosk Pro and will not run successfully in other browsers or within our in-app help interface.
  • To run sample code, set the app's homepage to kioskgroup.com/save-data-api
  • To download a .zip of sample code, click here.

Change Log

  • Added in version 1.1.1

Still stuck? How can we help? How can we help?