Introduction
Basic Concepts
Understanding Routing
Controllers
Views
Assets
Modules Calling Modules
Parent & Child Modules
Database Operations
Modules within Modules
Templates & Themes
Helpers Explained
Form Handling
Working with Files
The Module Import Wizard
Authorization & Authentication
The API Explorer
If you’ve found an error, spotted something missing, or feel a section could be clearer or better explained, we’d love to hear from you. Your feedback helps keep the documentation accurate and useful for everyone.
Please report issues or suggest improvements on GitHub. Community input is invaluable in making the docs stronger.
Not comfortable with GitHub? No problem — you can also get in touch with us directly via our contact form. We welcome all feedback.
Processing Form Submissions
In Trongate, after form validation is complete, the next crucial step is processing the submitted data. This section covers the implementation patterns for handling validated form data.
The Data Processing Workflow
A typical form processing workflow in Trongate follows this pattern:
Processing Valid Submissions
When handling validated form data, you'll typically need to:
- Collect the submitted data
- Determine the operation type (insert or update)
- Perform the database operation
- Provide user feedback
- Direct the user to the next appropriate page
Here's a real-world example that demonstrates this workflow:
Data Collection Strategies
The get_data_from_post()
method is crucial for organizing form data. Here's an example that includes data transformation:
When performing form validation, the framework ensures that the data being validated matches the data that will be processed. This is achieved through the integration of the post()
function in the validation process.
For example, when the following validation rule is declared:
The validation system will internally evaluate:
The post()
function, when called with a second argument of true
, performs two cleaning operations:
- Removes whitespace from the beginning and end of strings
- Normalizes internal spacing (multiple spaces become single spaces)
Therefore, to maintain consistency between validation and data processing, values should be retrieved after validation using post($str, true)
. In situations where this cleaning behavior is not acceptable, it's advisable to consider using custom validation.