Extra params for custom error messages

Created on 29 October 2015, over 9 years ago
Updated 25 January 2025, 5 days ago

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 :)

✨ Feature request
Status

Closed: outdated

Version

2.0

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands spadxiii

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡¦Ukraine AstonVictor

    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

Production build 0.71.5 2024