Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
73 lines (62 sloc) 2.59 KB
---
layout: default
navPage: docs
heading: Submission Pre-Parser
breadcrumbs:
- Modules,/modules
- Submission Pre-Parser
next: Rules,/modules/submission_pre_parser/rules
categories: modules
page_type: introduction
tags: developer
---
{% include open_section.html nav='nav_submission_pre_parser.html' selected='overview' %}
<h3>Overview</h3>
<p>
The Submission Pre-Parser module provides a simple UI to add your own PHP to change the incoming POST data
before it gets added to the database. The module is actually just an easy way to attach your own code to the
<a href="{{site.baseurl}}/module_development/hooks">Form Tools hooks</a> for the submission insert and update
functions/methods:
</p>
<div class="row">
<div class="col-lg-6"><b>Form Tools 2</b></div>
<div class="col-lg-6"><b>Form Tools 3</b></div>
</div>
<div class="row">
<div class="col-lg-6">ft_process_form</div>
<div class="col-lg-6">
Submissions::processFormSubmission()
</div>
</div>
<div class="row">
<div class="col-lg-6">
<a href="{{site.baseurl}}/api/ft_api_process_form/">ft_api_process_form()</a>
</div>
<div class="col-lg-6">
<a href="{{site.baseurl}}/api/v2/process_form_submission/">$api->processFormSubmission()</a>
</div>
</div>
<div class="row">
<div class="col-lg-6">ft_update_submission()</div>
<div class="col-lg-6">Submissions::updateSubmission()</div>
</div>
<br />
<p>
There's no reason why you can't utilize these hooks in your own modules, but we found that modifying the data
prior to submission is such a useful feature, it warranted its own module.
</p>
<p>
Modifying and accessing the form data prior to submission has a number of uses, for example:
</p>
<ul>
<li>If you need to group multiple form fields into one for simpler presentation in the Form Tools UI (e.g. if
your form has a telephone number field split into 3 smaller fields).</li>
<li>The opposite: you need to split a single form field into multiple fields.</li>
<li>You want to ignore submissions that contain certain values in certain fields (e.g. this can be really handy
for spam detection)</li>
<li>You want to execute custom code submissions with particular field values (e.g. adding to another database)</li>
</ul>
<p>
The following sections explain the basic usage of the module and include some simple examples.
</p>
{% include close_section.html %}