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

SmartyValidate 3.0 released

 
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
mohrt
Administrator


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

PostPosted: Thu Jan 20, 2011 7:43 pm    Post subject: SmartyValidate 3.0 released Reply with quote

This is basically SmartyValidate 2.9, but updated to be compatible with Smarty 3.0+. This version works only with 3.0 and up.

http://www.phpinsider.com/php/code/SmartyValidate/
Back to top
View user's profile Send private message Visit poster's website
robdawg
Smarty Rookie


Joined: 15 Jul 2005
Posts: 13

PostPosted: Thu Feb 10, 2011 3:03 pm    Post subject: Reply with quote

Anyone having a problem with register_validator?

I have a file in the plugins directory named: validate_criteria.isValidForgotPassword.php

Inside that file, I have a function named: smarty_validate_criteria_isValidForgotPassword

I then call the register_validator function: SmartyValidate::register_validator('check_forgot_password', 'login_email', 'isValidForgotPassword', false, false, 'trim', 'ForgotPasswordForm');

Problem is, I get this error:
Notice: SmartyValidate: [is_valid] criteria function 'isValidForgotPassword' was not found. in C:\wamp\www\SITENAME.com\includes\Smarty3\SmartyValidate.class.php on line 588

Any ideas?

Thanks.
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Thu Feb 10, 2011 3:08 pm    Post subject: Reply with quote

make sure your plugin files are all lower-case. Smarty 3 this matters because of the autoloader.
Back to top
View user's profile Send private message Visit poster's website
robdawg
Smarty Rookie


Joined: 15 Jul 2005
Posts: 13

PostPosted: Thu Feb 10, 2011 3:25 pm    Post subject: Reply with quote

Great!

This worked but I also had to remove the "_" from the filename as well.

All good now, thanks again!
Back to top
View user's profile Send private message
conner_bw
Smarty Rookie


Joined: 21 Dec 2007
Posts: 17

PostPosted: Thu Apr 21, 2011 3:15 am    Post subject: Reply with quote

Using 3.0.2-ish, found two minor bugs today:

1)
/plugins/function.validate.php
A bunch of $smarty->trigger_error, these are deprecated and should simply be trigger_error.

2)
In my app I was getting:
Notice: Undefined index: Date in libs/SmartyValidate.class.php on line 199

Line 199:
if(is_array($formvars[$_field]) && @is_array($formvars[$_field]) && !$_trans_on_array) {

Should be:
if(@is_array($formvars[$_field]) && !$_trans_on_array) {

Regards,
Back to top
View user's profile Send private message
techsterx
Smarty n00b


Joined: 20 Aug 2011
Posts: 1

PostPosted: Sat Aug 20, 2011 3:12 am    Post subject: Reply with quote

I'm currently updating one of my sites to Smarty3 and ran into a couple issues with SmartyValidate. It seems the {$validate} variable along with the {validate} append attribute are no longer working. I checked all the docs and haven't noticed any changes with these.

Am I over looking something or could this something with my code? I created a plugin to handle this for my page, but everything else on there seems to be working alright and I'm not getting any more errors after making it compatible with Smarty3.
Back to top
View user's profile Send private message
robdawg
Smarty Rookie


Joined: 15 Jul 2005
Posts: 13

PostPosted: Fri Sep 23, 2011 1:57 pm    Post subject: Reply with quote

Quick issue again, anyone having a problem with only the FIRST validator returning the error message?

I have 3 validators that append the error message to a variable and only the first error is getting set properly. The other 2 errors are are returning blank error messages.

Any ideas?
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Fri Sep 23, 2011 2:09 pm    Post subject: Reply with quote

post a working example (pastebin), I'll check it out
Back to top
View user's profile Send private message Visit poster's website
robdawg
Smarty Rookie


Joined: 15 Jul 2005
Posts: 13

PostPosted: Fri Sep 23, 2011 3:22 pm    Post subject: Reply with quote

Here is my PHP Code:
http://pastebin.com/7qF4T5LY

Here is my HTML Code:
http://pastebin.com/NVfzfJ0e

I am using the latest version of Smarty and SmartyValidate.

Thanks again for checking this out.
Back to top
View user's profile Send private message
robdawg
Smarty Rookie


Joined: 15 Jul 2005
Posts: 13

PostPosted: Sat Sep 24, 2011 6:05 pm    Post subject: Reply with quote

I think I might of found a possible issue.

In file function.validate.php on line 144 you will find this:
$_sess['is_init'] = false;

The above line will get called on each validator, so anything after the first validator will not have the correct INIT flag.

Here is what is in the compiled template:
<?php echo smarty_function_validate(array('form'=>"ForgotPasswordChangePassword",'id'=>"check_forgot_password1",'message'=>"Must be a valid Password (6-16 Characters).",'append'=>"formErrors"),$_smarty_tpl);?>

<?php echo smarty_function_validate(array('form'=>"ForgotPasswordChangePassword",'id'=>"check_forgot_password2",'message'=>"Passwords do not Match.",'append'=>"formErrors"),$_smarty_tpl);?>

As you can see it is getting called twice but the second call will have an INIT flag of FALSE and not set the proper variables.

No solution yet, let me know if you see something.

Thanks.
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Mon Sep 26, 2011 2:41 pm    Post subject: Reply with quote

I think I found it, here is the new function.validate.php plugin:

[removed, see next message below]

let me know if that works.


Last edited by mohrt on Mon Sep 26, 2011 3:08 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


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

PostPosted: Mon Sep 26, 2011 3:08 pm    Post subject: Reply with quote

Had to update it one more time, here it is:

http://pastebin.com/vYsiFRCk
Back to top
View user's profile Send private message Visit poster's website
Crazyman
Smarty n00b


Joined: 29 Dec 2011
Posts: 1

PostPosted: Thu Dec 29, 2011 9:56 am    Post subject: Reply with quote

mohrt wrote:
Had to update it one more time, here it is:

http://pastebin.com/vYsiFRCk

Thanks for updates!
Back to top
View user's profile Send private message
mmopin22
Smarty n00b


Joined: 30 May 2013
Posts: 1

PostPosted: Thu May 30, 2013 9:00 am    Post subject: Reply with quote

The world has transformed from the traditional era of conducting business. In this modern day, online business has grown to be very popular. This online business usually involves virtual goods. These are goods that, though not physical, are owned and their value is tangible to the owner. It is these virtual goods that are the main items of trade in online business. In this context, the effect of FIFA 13 coins in the world of FIFA online gaming is immense and worth the irrefutable repute they have gained.


------------------------------
gw2 gold|wow gold|rs gold
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