Feature #2405
Add condition before inserting record in the database
Status: | Resolved | Start date: | 2009-01-04 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Reinhard Führicht | % Done: | 0% |
|
Category: | Misc | |||
Target version: | - |
Description
Before inserting a new record in the database, it would be convenient to have a condition. According to some typoscript configuration, GP parameters will be tested. The test will tell whether the data are appropriate for the database or not. If result is TRUE, data are stored, if result is FALSE, nothing happen. I would suggest to add a new typoscript keyword "condition".
Below an example:
finishers { 1 { class = F3_MailformPlusPlus_Finisher_DB config { condition = first_name != 'asdf' && last_name != 'asdf' ... } }
I let you check the patch.
Associated revisions
[Bug 2405] Drop unused variables, r=saskia
History
#1 Updated by Reinhard Führicht over 6 years ago
- Category set to Misc
- Assigned To set to Reinhard Führicht
Why not do these checks in form validation? Is it useful to let the form submit, but then not save the values into database because the evaluation fails?
Don't get me wrong, I think it's quite useful to do such checks, but they are possible in validation right now. Is there a need for these checks before saving into database?
#2 Updated by Fabien Udriot over 6 years ago
Don't get me wrong, I think it's quite useful to do such checks, but they are possible in validation right now. Is there a need for these checks before saving into database?
In my use case, a visitor can submit a form which will generate an email in any cases. But for a certain value in the form, the data needs to be inserted in the database, respectively not for an other value. At the moment, I don't see how to achieve this with a validator.
Is my explanation enough clear?
Thus, I propose to add a condition. Maybe the syntax is not the best, I admit. This is a more PHP way to write condition.
#3 Updated by Reinhard Führicht over 6 years ago
The patch got included to source. I don' think that the PHP syntax of the condition is a problem. In my opinion, people using this feature will be developers anyway, who know how to write a condition in TS and PHP.
#4 Updated by Reinhard Führicht over 6 years ago
- Status changed from New to Resolved