Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Trouble with criteria on isFileType

 
Post new topic   Reply to topic    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
SFBILL
Smarty Rookie


Joined: 09 Apr 2005
Posts: 12

PostPosted: Fri Jul 22, 2005 6:30 pm    Post subject: Trouble with criteria on isFileType Reply with quote

I'm trouble registering the isFileType validator for a form named upload_image and a field named OriginalImage1. Any assistance on the proper syntax for this?

PHP:

SmartyValidate::register_validator('uploadfile','OriginalImage1:jpg,gif,png','isFileType','upload_image');

and

SmartyValidate::register_validator('uploadfile','OriginalImage1:jpg,gif,png','isFileType',false,'upload_image');

...and a bunch of other combinations have not worked...the syntax needed isn't clear to me from the doc - it only shows how to use the default form.

Error:
Smarty error: validate: missing 'criteria' parameter
Back to top
View user's profile Send private message Send e-mail
mohrt
Administrator


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

PostPosted: Fri Jul 22, 2005 9:35 pm    Post subject: Reply with quote

What does your template validator look like? You have to supply the form name...

{validator id="uploadfile" form="upload_image" message="blah"}
Back to top
View user's profile Send private message Visit poster's website
SFBILL
Smarty Rookie


Joined: 09 Apr 2005
Posts: 12

PostPosted: Sat Jul 23, 2005 12:47 am    Post subject: Old and new Reply with quote

Thanks for the response - I did have the form name in there...but - since I was converting a template that used the old validator method and changing it to use the new method, I had field= instead of id= so I think that was the issue - it is now working.

However, I had already resorted to using the default form and got rid of the form name. The trouble I sometimes have with using validator is getting the parameters right when I register the validator. The example in the readme doesn't show the use of a form name, so I'm still not sure what the syntax would be to register the validator (is it one of the two options I have above?) For future reference, it would be good to know.

Thank you for your continued support on the forum!!
Back to top
View user's profile Send private message Send e-mail
mohrt
Administrator


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

PostPosted: Sat Jul 23, 2005 2:34 pm    Post subject: Reply with quote

If you supply a form name when you register a validator, you have to supply that form name on the validator tag in the template. Thats about it.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Plugins 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