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.
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.
Comment | File | Size | Author |
---|---|---|---|
#3 | webform_validation-7.x-1.x-addsid-1388080.patch | 1.18 KB | Liam Morland |
#1 | webform_validation-6.x-1.x-addsid-1388080-1.patch | 1.19 KB | vernond |
#1 | webform_validation-7.x-1.x-addsid-1388080-1.patch | 1.18 KB | vernond |
Comments
Comment #1
vernond CreditAttribution: vernond commentedPatches for 6.x-1.x and 7.x-1.x branches attached.
Comment #2
vernond CreditAttribution: vernond commentedIn 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
).Comment #3
Liam MorlandFixed for D7 in 25133fc. Patch attached.
Comment #4
Liam MorlandComment #5
Liam MorlandComment #6
svendecabooterAdded on the D6 branch as well.