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

quicksketch’s picture

Status: Active » Closed (won't fix)

I don't help with custom coding.

filpet’s picture

Status: Closed (won't fix) » Active

this 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!

quicksketch’s picture

Ah, 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.

quicksketch’s picture

Status: Active » Closed (won't fix)