"must equal an other field" and "can not equal an other field" should be generalized to also being able to check for "greater than (or equal to) other field" and "less than (or equal to) other field". This should work with dates so that one can check that end dates are after start dates.

Comments

liam morland’s picture

Project: Clientside Validation » Webform Validation
Version: 7.x-1.x-dev » 7.x-1.1
Component: Webform Validation » Validation rules

Sorry, I meant to put this on the Webform Validation queue.

liam morland’s picture

Status: Active » Needs review
StatusFileSize
new3.87 KB

Patch implementing this feature.

liam morland’s picture

StatusFileSize
new3.46 KB

Updated version uses custom error messages.

svendecabooter’s picture

Status: Needs review » Needs work

Thanks for the new validation rule. It's looking good on first sight.

Some remarks:

  • Is there a use case for enabling this rule on the 'email' and 'hidden' component? Don't see how an email address could be greater than another?
  • Related: did you test with all component types? I checked date, time & textfield for now.
  • Might need some explicit documentation that it's the first checked component being compared to the second, using the entered operator. As this might not be crystal clear on first sight (though it's pretty logical)

Other than that I don't see any issues with it, so when those are adressed we might go ahead and commit it.

Note to self: patch also applies on 6.x branch by the way.

liam morland’s picture

Status: Needs work » Needs review
StatusFileSize
new3.54 KB

I think I left in all the component types because you never know what someone might want to be able to do. A comparison with a hidden could be used to enforce a number in a range, for example.

I did not individually test all component types. I figured they all work about the same. I tested time and date separately because they have different code execution paths.

I have attached a patch with improved help text.

svendecabooter’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

liam morland’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Reviewed & tested by the community » Fixed
StatusFileSize
new3.55 KB

Fixed in f803325. As-fixed attached.

liam morland’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Fixed » Patch (to be ported)
liam morland’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Issue summary: View changes
Status: Patch (to be ported) » Closed (fixed)

Drupal 6 is no longer supported.

solideogloria’s picture

Just a note. This validator isn't in the list of available validators on the module front page.