Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I allow users to save a draft of the webform in order to complete it later.
However I have in additional processing a function which adds a role to their account which keeps them from accessing this questionnaire.
Every time an user saves the questionnaire as a draft this role is added which is really annoying!
Comments
Comment #1
quicksketchI don't help with custom coding.
Comment #2
filpet CreditAttribution: filpet commentedthis isn't about custom coding, it's about that it below the additional processing field it clearly says:
Additional processing code can be used to save data to external sources or modify the data before it is saved. This code is only executed after all validation has passed and the entire form has been completed. For examples of processing code, see the Webform handbook on submission code
"the entire form has been completed" <<- that's exactly what this is not doing, it is executed before the form is completed!
Comment #3
quicksketchAh, well saving a draft "saves" the submission to the database just like a normal complete submission, it's just flagged as a draft. I suggest checking $form_state['values']['op'] or $form_state['clicked_button']['#value'] to prevent saving on draft button clicks.
Perhaps the help text should be "Completed or a draft is saved", since that's actually the case and more helpful than not having a way to execute code on saving a draft.
Comment #4
quicksketch#1043088: This project is abandoned, please stop using it