First of all, thanks for developing and maintaining this great module.
The problem I've encountered is that the for a multipage webform with multiple conditionals is not firing.
Event
After a webform has been submitted
Condition: Webform has name
Parameters:
The form id of the submitted form: [form_id]
Webforms: Mid-program quiz
Action: Add user role
Parameters:
User: [user]
Roles: Mid-program quiz: Passed
It's fairly clear that it's a code issue because when I change Event to "After a webform has been saved as draft", the rule fires upon saving a draft, and the user role gets promoted.
Has anyone else had this problem? Any suggestions would be much appreciated!
Comments
Comment #1
Roensby commentedI have the same issue, except with no conditionals, only a multipage form.
If I remove the pagebreak component, the submission rule triggers.
edit: I think the problem concerns the setting in webforms "Automatically save as draft between pages"
If it is enabled, submissions have the is_new variable set to false, which in turn makes webform_submission_insert not call
module_invoke_all('webform_submission_insert', $node, $submission);in webform.submissions.inc, thus the rule is never triggered.If "Automatically save as draft between pages" is disabled, submissions trigger the "After a webform has been submitted" rule as they should.
Comment #2
grahamcYou should be able to get around the problem with drafts by reacting to both "After a webform has been submitted" _and_ "After a submission draft has been submitted" events.
... it's not at all obvious that one would need to use both events, though. Reacting when the form is finally submitted (whether via a draft submission or not) is likely the most common thing to want to do, so ought to be covered by a single Rules event.
Comment #3
guignonvI made a patch that solved the problems I reported in issue #2262755 (https://www.drupal.org/node/2262755) which has been marked as duplicate of this one.
It's the first time I make a patch for a Drupal contrib' module using git so... be indulgent if I made some mistakes... and feel free to let me know what was wrong if any! ;-)
And of course, review the patch and report if it solved your problem.
Comment #4
guignonvI found out that the full content of the submission was not passed to the rule handler (maybe because of a multiple-page webform). So I improved my previous fix with this one (that should replace it).
Comment #5
guignonvComment #6
guignonvComment #7
hserus commentedHi guignonv thanks for your patch, it's work great. But in my case it works only to the multipage webform not to single page webforms. Here I made small changes in your patch to make work to both single page and multipage webforms. I am not sure whether this is the proper way to apply patch and not yet created a new patch.
Comment #8
broonThanks for this patch. It took me quite some time to actually find the source of my problem to be with webform rules.
Simply applied hserus' patch and it worked right away. Good job all of you!
Comment #9
hserus commentedComment #10
albie001 commentedHi,
I am having the same problem with rules on a multi-page webform.
I have tried to apply patch 5 but keep getting the following error when doing so
patch: **** malformed patch at line 27: + $submission->data[$cid]['value'] = $value;Any chance someone could provide me with the patched file?
Comment #11
albie001 commentedUPDATE
I had been on a different machine and was trying to use cygwin to apply the patch.
Went back to using Netbeans and patch installed without issue.
Works like a charm.
Thanks
Comment #12
albie001 commentedAfter applying patch 5 and after some further testing I am getting the following error message when submitting the form.
Notice: Undefined index: page_break in webform_rules_rules_invoke_event() (line 130 of .../sites/all/modules/webform_rules/webform_rules.module).
It doesn't appear to be causing any major issues other than the end users sees this message when they submit their form.
Comment #13
joelhsmith commentedHey @albie001 I was getting the same error. Can you hook me up with that sucessfully patched file?
Comment #14
joelhsmith commentedNever mind. My issue was actually this: https://www.drupal.org/node/2487540#comment-10311045
Comment #15
_vid commented@hserus
We were experiencing some issues with the patch syntax when trying to apply webform_rules-submission_rule_firing-1964590-5.patch
Specifically:
So I manually applied the changes from the patch and rolled a fresh one that is effectively the same but applies w/ no errors to the 7.x-1.6 release and the 7.x-1.x head (as of today: commit: 42a1801).
While I haven't tested the functionality of the patch itself, if it's the right solution then hopefully this will help folks leverage your solution.
Comment #16
silurius commentedThank you, @_vid. #15 works well here so far. Let's RTBC it!
Comment #17
john_b commentedI am reluctantly setting this back to Needs Work. The patch does ensure that the Action 'create node' fires. However, on a mutli-page form the webform submitted data is not reliably available for using rules to do a Rules 'set data' action i.e. to populate a node field, froma form submission field. The only data reliably available is basic node data from the Webform.