Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Unable to validate or rules skipped

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
schoenung
Smarty Rookie


Joined: 05 Apr 2004
Posts: 28

PostPosted: Tue Mar 08, 2005 3:11 am    Post subject: Unable to validate or rules skipped Reply with quote

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
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue Mar 08, 2005 2:42 pm    Post subject: Reply with quote

What is the plugin file names? Have you put any debug info in the plugins to verify they are being executed?
Back to top
View user's profile Send private message Visit poster's website
schoenung
Smarty Rookie


Joined: 05 Apr 2004
Posts: 28

PostPosted: Tue Mar 08, 2005 3:15 pm    Post subject: debug info Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP