Advanced Form Submission & FileMaker

Has anybody here used the Advanced Form Submission feature? I need to get data from a registration form in Sparkle into a FileMaker database. With no instructions available on the Sparkle side of things, I only have FileMaker documentation to work with, and there are huge how-to gaps in between.

I’ve looked at a bunch of online videos, but there’s a common pattern. Even the best, well-intentioned presenters can’t last more than 10-15 minutes of carefully packaged content before they lapse into intensive, mind-blowing geek speak.

1 Like

Any transfer of data between a form submission and a database is going to require a form script on your server that extracts the form field data and stores it in a database or CSV file. That file can then be used to add the data to an external application database.

Whilst there are free scripts that can handle the process of collecting your form data from form submission and store the data into some form of file format, it will be a completely separate job to have the data file automatically integrate with the external FileMaker database.

There are some basics it would be nice to know. For example, when you hit the button triggering an “Advanced Form Submission”, what kind of file does Sparkle generate? Is it in JSON, SML, HTML, or what?

Essentially, form fields are just text containers, the contents of which are sent to your form script. Unless your script specifies something else, the contents of your form fields will be simply emailed as plain text. If you wanted your form responses sent to you in HTML format, your script would typically have to have this facility, allowing you to set up an HTML template which can be populated with your form data.

Yes, when the FileMaker database responds to a Sparkle “Post”, FileMaker will control how the data is returned to a Sparkle website. But that’s not what initiates the sort of data exchange I need. When you hit a Sparkle button that triggers a “Post” that initiates an “Advanced Form Submission”, it’s Sparkle that determines the format of that initial data transfer. The FileMaker script that receives it has to be configured to capture & parse that data appropriately.

You’ve disclosed that Sparkle sends plain text in the initial “Post”, but you haven’t yet told me what form it’s in. Does it go out in JSON? Is it a comma-separated text file with returns? Or is it tab-separated text? Does the data go out in pairs with the name of the field/variable first and the data in the field second? You can’t construct an appropriate FileMaker script without that information.

Your server will receive a string of data which includes a header plus all the form data as a set of value pairs separated by an ampersand (&). Here is an example:

Content-Type: application/x-www-form-urlencoded
Content-Length: XX

name=Fred Bloggs&email=some email address&subject=Form Response&message=My message content

If you use the post method, the data will be sent as above. If you use the get method, the data string will be appended to the actual URL when the form is submitted. This isn’t a preferred method because there may be restriction on the length of a URL that can be sent. Also, the URL would expose the form data in the URL which may become visible.

If you use the get method the following data string will be appended to the URL of your script:

/?name=Fred Bloggs&email=some email address&subject=Form Response&message=My message content HTTP/2.0

The URL where the data is sent will typically be the URL of a processing script. The script will receive the data and extract the data string. This will then be parsed to retrieve the data as a list of key/value pairs. These are usually then added to an email message that get’s sent to the form recipient. It ends up looking like this:

name=Fred Bloggs
email=Some Email Address
subject=Form Response
message= My Message Content

However, your script can be configured to use the key/value pairs in other ways, such as sending to a database, filling an HTML template or creating a CSV file. More complex scripts may be able to send the data to other applications for further processing. E-commerce shopping carts are a prime example, where the date is used to create an order and its associated invoice.

Whilst PHP is the more usual language used for processing data, there is nothing preventing you from using alternative languages as long as they are supported by your web server.

The advanced form submission option is simply a mechanism for you to define a URL for the submission. So, if you created your own script to manage the data, you would simply add the URL of that script by selecting the advances form submission option. If this isn’t used, the data will be sent to the standard Sparkle generated script.

I send my forms to a special email address. Then a FMkr script using 360WorksEmail plugin, run regularly on the server, reads all new emails and another script parses the data as required. Maybe not as elegant but it works.