The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.28 (Linux)
|
Submission editation of two forms from one Pre-Parser code - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5) +--- Thread: Submission editation of two forms from one Pre-Parser code (/showthread.php?tid=405) |
Submission editation of two forms from one Pre-Parser code - nomad - Dec 21st, 2009 I use Pre-parser module for some Form submissions, always works fine. But there must be some trick, how to edit two different form IDs withing one rule, because the code works unexpectedly! Example: Processing new submission on form id 5 via Pre-Parser rules - no troubles. In the middle of code I need to edit submission id 2 from another form id 7 by: ft_update_submission (7, 2, $hash) At this moment results of whole rule starts be strange, it looks that adding one AND updating second form are interfering (results depends also on location of ft_update_submission in the code). I have unique names of form fields, for database fields using the same names as forms have. Does somebody have an idea? Or is there any other way, how to update two tables in two different forms? Actually I need only check the validation of discount coupon during counting a price and disable its validity after first use. Thank you for any help. RE: Submission editation of two forms from one Pre-Parser code - Ben - Dec 24th, 2009 I had to mull this one over a bit - neat scenario! I think what may be happening is this: the Submission Pre-Parser module uses a hook in the ft_update_submission function to process your code at the right spot. Since you're calling that function within the Pre-Parser it's getting confused somehow. At first I thought you'd get a infinite loop, but if you're updating a different form it shouldn't do that. I think you may be stuck manually updating the submission via an SQL query rather than with using the ft_update_submission function. Crappy, I know. Other solutions.... hmm. What we really need is a "form mapping" module or something like that, that on a meta-data level creates foreign key relationships between tables and lets you map data in one form to another. But that's a pretty whopping job. Probably your best bet is to continue with the Submission Pre-Parser for now, or possible creating a custom module to do the same thing. Sorry I don't have any great ideas. - Ben RE: Submission editation of two forms from one Pre-Parser code - nomad - Dec 30th, 2009 (Dec 24th, 2009, 10:59 AM)Ben Wrote: I had to mull this one over a bit - neat scenario! Hi Ben, thank you for ideas. Small db trigger resolved my trouble, the simplest solution is always fine even if the final code is not so pure. For the future I am going to rebuild my form to "more clever" multi-page one and do a most of programming inside, Pre-parser module will serve just for refining the rest. And, of course, will study hook module, I feel this shoud be the right way. Regards, Pavel |