Hi,
thanks alot for this great module.

Is it possible to add a "Starts with" functionality to this module.

For example I want the webform to only accept the numbers that start with "800". So any number with 800xxxxx would be accepted. others not.

x = anynumber

It would also nice to able to define a specific formula like make the webform to only accept "800xxxx8xxxx8".

I want to use a webform to gather lottery code numbers and I need it to only accept valid codes!

I think that remaining feature would make this module perfect!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bart.hanssens’s picture

This can be achieved by using the "regular expression" validation rule, with the special character ^ (= "starts with"). For instance, ^800

bart.hanssens’s picture

Status: Active » Needs review
Liam Morland’s picture

Status: Needs review » Active

"needs review" should only be used when a patch has been submitted.

Liam Morland’s picture

Both the starts-with and the pattern can be done with regular expressions. I expect that many users who do not know regular expressions would want to do simple things like starts-with. Webform Validation already has rules which do things that can be done with regex, so I think this is a reasonable feature request. For now, you can use regex.

Liam Morland’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Active » Fixed
FileSize
2.43 KB

Fixed in ffe73af. Patch as-committed attached.

The pattern can be done with regex or #1082134: Pattern validator would do that too, once finished.

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.