Download & Extend

2 fields with the same validator in one form and different arguments fails

Project:Validation API
Version:6.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:cardina1
Status:needs review

Issue Summary

I have Drupal 6.10 with CCK 6.x-2.2 and Validation_API 6.x-1.0.

I want to check two CCK text fields f1 and f2 with the regexp rule /^[0-9]{1,%arguments[0]}$/. They are on the same form. f1 must be 10 or less characters long and f2 – 20 characters or less. So I added validator to this two fields with different arguments.

I get validation for both fields 10 or less characters long.

After some research I found a bug (I think) in the code string
$validator->rule = str_replace('%arguments['. $delta .']', $argument, $validator->rule);.

All works fine after fix, but still, please review it. All the changes in the patch.

AttachmentSize
validation_api_mixed_regexp_arguments.patch1.06 KB

Comments

#1

Sorry, first patch don't allow several argiments in a regexp. Here is a new revision.

AttachmentSize
validation_api_mixed_regexp_arguments[1].patch 970 bytes