Home » Database » DB_Table » Bug #3825
Change $elemname in error messages to $col['qf_label']
Details
| Request #3825 | Change $elemname in error messages to $col['qf_label'] |
|---|---|
| Submitted | 2005-03-15 14:00 UTC |
| From | rotmer at gmail dot com |
| Assigned | pmjones |
| Status | Closed |
| Package | DB_Table |
| PHP Version | Irrelevant |
| OS | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2005-03-15 14:00 UTC] rotmer at gmail dot com
Description:
------------
In DB_Table_QuiclkForm class in fixColDef method when default
qf_rules constructed based on $col['require'], $col['type'] and $col['size'] its sprintf error message with $elemname and resulting messages look not so good, like 'The item fv[name] is required.'. I propose to change $elemname to $col['qf_label'], it will be equal to $elemname anyway in case $col['qf_label'] wasn't set in user's table class, but resulting error messages would look much better when user set
it.
Reproduce code:
---------------
Proposed fix as of DB_Table v1.0:
in Table/QuickForm.php lines 772-775
$col['qf_rules']['required'] = sprintf(
$GLOBALS['_DB_TABLE']['qf_rules']['required'],
$elemname
);
change to
$col['qf_rules']['required'] = sprintf(
$GLOBALS['_DB_TABLE']['qf_rules']['required'],
$col['qf_label']
);
lines 786-789
$col['qf_rules']['numeric'] = sprintf(
$GLOBALS['_DB_TABLE']['qf_rules']['numeric'],
$elemname
);
change to
$col['qf_rules']['numeric'] = sprintf(
$GLOBALS['_DB_TABLE']['qf_rules']['numeric'],
$col['qf_label']
);
lines 799-803
$msg = sprintf(
$GLOBALS['_DB_TABLE']['qf_rules']['maxlength'],
$elemname,
$max
);
change to
$msg = sprintf(
$GLOBALS['_DB_TABLE']['qf_rules']['maxlength'],
$col['qf_label'],
$max
);