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

[SV] isURL query

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
Net Genius
Smarty Rookie


Joined: 25 Aug 2008
Posts: 7

PostPosted: Mon Aug 25, 2008 4:05 pm    Post subject: [SV] isURL query Reply with quote

Hi. I'm just starting to use smartyValidate, and I like what I see, but I have a quick question.

I'm looking to use the isURL validator, however I only want it to run if the field isn't empty.

I.e. if the field is left blank, then the script continues as normal, however if someone does enter something, then that something needs to be a valid URL.

Can you point me in the right direction please?

Thank you.
Back to top
View user's profile Send private message
Celeb
Administrator


Joined: 17 Apr 2007
Posts: 1025
Location: Vienna

PostPosted: Mon Aug 25, 2008 4:11 pm    Post subject: Reply with quote

This should do the trick:
Code:
SmartyValidate::register_validator('foo', 'url', 'isURL', true);

_________________
Darn computers always do what I tell them to instead of what I want them to do.
Back to top
View user's profile Send private message
Net Genius
Smarty Rookie


Joined: 25 Aug 2008
Posts: 7

PostPosted: Mon Aug 25, 2008 4:14 pm    Post subject: Reply with quote

That works a treat. Thank you Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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