There are times when custom validation needs to know whether it is working on an existing Webform submission (edit mode) or on a new Webform submission.

Appending the Webform submission id if it is known (i.e. in edit mode) to the $rule array would solve this. Because it is just another item appended to the array, there should be no compatibility issues with existing installations.

Patches for both branches to follow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vernond’s picture

Patches for 6.x-1.x and 7.x-1.x branches attached.

vernond’s picture

In hook_webform_validation_validate we will now be able to tell whether we are dealing with a new submission ($rule['sid'] == 0) or whether it's an existing submission being edited ($rule['sid'] != 0).

Liam Morland’s picture

Status: Needs review » Fixed
FileSize
1.18 KB

Fixed for D7 in 25133fc. Patch attached.

Liam Morland’s picture

Version: 7.x-1.1 » 6.x-1.5
Status: Fixed » Patch (to be ported)
Liam Morland’s picture

Version: 6.x-1.5 » 6.x-1.x-dev
svendecabooter’s picture

Status: Patch (to be ported) » Fixed

Added on the D6 branch as well.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.