Ticket #607 (closed Feature Request: wontfix)

Opened 5 months ago

Last modified 5 months ago

Validation , ability to add rules as array (patch attached)

Reported by: ae Owned by: - No owner -
Priority: minor Milestone: 2.2
Component: Libraries:Validation Version: SVN HEAD
Keywords: Validation, add_rules Cc:

Description

It would be handy to be able to pass validation rules as an array instead of function arguments.

So instead of:

$validation->add_rules('email', 'required', 'email', 'length[1,100]');

You could use:

$rules = array('required','email','length[1,100]);
$validation->add_rules('email',$rules);

This is useful if you are creating forms dynamically or are storing validation for fields in the db etc.

Cheers

andrew

Attachments

validation_add_rules.patch (0.6 kB) - added by ae 5 months ago.

Change History

Changed 5 months ago by ae

Changed 5 months ago by Shadowhand

  • status changed from new to closed
  • resolution set to wontfix

Changed 5 months ago by Shadowhand

Why? Because you can use an array (as a callback) for a rule.

Note: See TracTickets for help on using tickets.