FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Submission editation of two forms from one Pre-Parser code
#1
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.
Reply
#2
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
Reply
#3
(Dec 24th, 2009, 10:59 AM)Ben Wrote: 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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)