|
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 |
SFBILL Smarty Rookie
Joined: 09 Apr 2005 Posts: 12
|
Posted: Fri Jul 22, 2005 6:30 pm Post subject: Trouble with criteria on isFileType |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Jul 22, 2005 9:35 pm Post subject: |
|
|
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 |
|
SFBILL Smarty Rookie
Joined: 09 Apr 2005 Posts: 12
|
Posted: Sat Jul 23, 2005 12:47 am Post subject: Old and new |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sat Jul 23, 2005 2:34 pm Post subject: |
|
|
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 |
|
|
|
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
|