Retrieving and using form results
Documentation for individual Magic Data symbols is provided by the built in help and is also available on the online symbols and documentation pages. Simply select the Magic Data Forms package in the 'Filter by add-on package' search box to see full documentation with examples.
This example assumes you have a site with the standard default content installed with a Contact Us form beneath the About page.
As usual, its easiest to get started by having a play in the dashboard symbol tester where you have the advantage of the diagnostic trace.
Dashboard > Magic Data > Symbols
With your symbol expressions tested and debugged, you can then embed them as tokens in a content block using [% %] and assign the block a Magic Data template.
Each use of Magic Data Forms must set a form interface and a form to connect to. Once set, these are used by subsequent Magic Data expressions on that page.
Here we set the interface as core_form and connect to the Contact Us form. LIST_FORM_RESPONSES 1 provides the most recent response. We then get the value of the "Name" field (The terminology in the core Form block is to get the Answer to a Question asked by the form).
SET "core_form" AS_FORM_INTERFACE SET "Contact Us" AS_FORM LIST_FORM_RESPONSES 1 FORM_VALUE_OF_FIELD "Name"
To go with this, we can also extract the associated "Message" field.
SET "core_form" AS_FORM_INTERFACE SET "Contact Us" AS_FORM LIST_FORM_RESPONSES 1 FORM_VALUE_OF_FIELD "Message"
This is similar to the example in the screenshots, save that some boilerplate text has been wrapped about the tokens that extract and show form data. In the screenshot examples, a memory has been used to save repeating the duplicated parts of the expressions.
Magic Data Forms is not limited to just the one form. You can interface to data collected through any form created using the core Form block. The forms interface is open and easily configurable to plug in interfaces to other forms packages or even any other source of tabular data.
Last updated: over a year ago