|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
schoenung Smarty Rookie
Joined: 05 Apr 2004 Posts: 28
|
Posted: Tue Mar 08, 2005 3:11 am Post subject: Unable to validate or rules skipped |
|
|
Trying to locate a bug that is causing a rule to be ignored. I have a plugin isZipCode as follows:
Code: |
function smarty_validate_criteria_isZipCode($value, $empty, &$params, &$formvars) {
if(strlen($value) == 0)
return $empty;
return (preg_match('(^\d{5}$)', $value));
} |
I'm checking a field called 'zip' with the following rules
Code: |
{validate field="zip" criteria="notEmpty" transform="trim" message="Required field" assign="zipErr"}
{validate field="zip" criteria="isZipCode" transform="trim" message="Unexpected formet" assign="zipErr"} |
The rule seems to be skipped as characters and everything else get validated. I've even changed the rule to isInt with no luck.
I have similar prolem with adding transforms to fields like
Code: |
function smarty_validate_transform_title($value, $params, &$formvars) {
return ucwords(strtolower($value));
} |
When I add the rule
Code: |
{validate field="firstname" criteria="notEmpty" transform="trim,title" message="Firstname is required" assign="firstNameErr"} |
The field is validated but not transformed.
Any help here is appricated. Some rules seems to work others do not. I would figure if the plugin was not found it would squak loud. Can someone point me where to look? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Mar 08, 2005 2:42 pm Post subject: |
|
|
What is the plugin file names? Have you put any debug info in the plugins to verify they are being executed? |
|
Back to top |
|
schoenung Smarty Rookie
Joined: 05 Apr 2004 Posts: 28
|
Posted: Tue Mar 08, 2005 3:15 pm Post subject: debug info |
|
|
I think I got the validation working. After I edited the file I assumed that smarty would compare the dates/times on the file and recompile the file. This does not seem to be the case. To fix the problem I manually wiped out the cache.
Some advice on controling the cache would be helpful. I do have compile_check=1 which I thought was supposed to stop what happened from happening.
Thanks
glen |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|