Ticket #687 (closed Bug: invalid)
Forge: Custom validation rules translations strings are displayed within the 'valid_type' string.
| Reported by: | galli | Owned by: | Shadowhand |
|---|---|---|---|
| Priority: | major | Milestone: | 2.2 |
| Component: | Modules:Forge | Version: | SVN HEAD |
| Keywords: | forge validation error message | Cc: |
Description
Hi everybody,
When using a custom validation rule in forge (MY_valid.php). The error string is displayed as follows:
"The test field must only contain validation.testvalid characters."
As you can see the i18n string is being included inside the 'valid_type' i18n. This is very annoying because it makes difficult to prompt to the user the real problem since you have the error string starting with a text that you probably don't want there.
In order to solve it I managed to delete these lines from the Form_Input.php file on the libraries folder of the Forge module (line 338):
case substr($func, 0, 6) === 'valid_': // Strip 'valid_' from func name $func = (substr($func, 0, 6) === 'valid_') ? substr($func, 6) :$func;
After doing that modification, the string for the error message should be put in place as follows in the validation.php i18n file:
'valid_testvalid' => 'Your error message!';
I hope this helps.
Best Regards, Fabián E. Gallina
