To allow for things like this:

//...

$form['myfield'] = array(
  '#type' => 'textfield',
  '#title' => 'My Field',
  '#required' => TRUE,
  '#rules' => array(
    'length[10, 50]', 
    array(
      'rule' => 'alpha_numeric',
      'error' => 'Please, use only alpha numeric characters at %field with extra an extra %param.'),
      'error params' => array(
        '%param' => t('Some param'),
      ),
  ),
);

//...

This instead of passing dummy data in the field and adding an error callback to generate the error message manually. I think this is a relative easy addition to fapi_validation_rules_execute() with some nice extras :)

Comments

SpadXIII created an issue. See original summary.

pedrofaria’s picture

Great idea. I will port it to Drupal 8 version

astonvictor’s picture

Status: Active » Closed (outdated)

I'm closing it because the issue was created a long time ago without any further steps.

if you still need it then raise a new one.
thanks

astonvictor’s picture

Status: Closed (outdated) » Active
astonvictor’s picture

Status: Active » Closed (outdated)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.