Home » HTML » HTML_QuickForm » Bug #1971
Allow {jsVar} substitution in HTML_QuickForm_RuleRegistry::getValidationScript
Details
| Request #1971 | Allow {jsVar} substitution in HTML_QuickForm_RuleRegistry::getValidationScript |
|---|---|
| Submitted | 2004-07-24 03:18 UTC |
| From | studio at peptolab dot com |
| Status | Wont fix |
| Package | HTML_QuickForm |
| PHP Version | Irrelevant |
| OS | Any |
| Roadmaps | (Not assigned) |
Comments
[2004-07-24 03:18 UTC] studio at peptolab dot com
Description:
------------
When creating a subclass of HTML_QuickForm_Rule, I was
trying to reference the {jsVar} in my prefix code,
however the HTML_QuickForm_RuleRegistry::
getValidationScript only performs a str_replace on the
$jsCheck variable, not $jsPrefix.
Is it possible to modify the code to allow substitution
for the prefix? It does not matter if 'value' is a
string/number or an array, as that can be determined on
the client-side JavaScript.
Reproduce code:
---------------
Line 179-180:
$js = $jsValue . "\n" . $jsPrefix .
" if (" . str_replace('{jsVar}', 'value', $jsCheck) . " && !errFlag['{$jsField}']) {\n" .
change to:-
$js = $jsValue . "\n" . str_replace('{jsVar}', 'value', $jsPrefix) .
" if (" . str_replace('{jsVar}', 'value', $jsCheck) . " && !errFlag['{$jsField}']) {\n" .
Line 186-187:
$js = $jsValue . "\n" . $jsPrefix .
" var res = 0;\n" .
change to:-
$js = $jsValue . "\n" . str_replace('{jsVar}', 'value', $jsPrefix) .
" var res = 0;\n" .
Expected result:
----------------
To substitute the {jsVar} string with the name of the
actual form element
Actual result:
--------------
Not implemented as yet