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

Validate form field only if its not empty

 
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
einlemming
Smarty Rookie


Joined: 04 May 2004
Posts: 10
Location: Stuttgart, Germany

PostPosted: Wed Jul 07, 2004 1:19 pm    Post subject: Validate form field only if its not empty Reply with quote

Hi guys,

I need some help with the SmartyValidator.
I am trying to validate a field only if it is not empty.
The Validation should be set to true if there is no content in the field, but if there is something typed in, I want to check for a number.

Example :

Leave the field empty : Form continues
Field has value "123" by the user : Form checks for isnumber.

Thanks in advance for your help!
_________________
See ya, Lemming
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: Wed Jul 07, 2004 1:25 pm    Post subject: Reply with quote

{validate field="myfield" criteria="isNumber" empty=true message="..."}

That will allow a decimal value too, use isInt for whole numbers only.
Back to top
View user's profile Send private message Visit poster's website
einlemming
Smarty Rookie


Joined: 04 May 2004
Posts: 10
Location: Stuttgart, Germany

PostPosted: Wed Jul 14, 2004 1:15 pm    Post subject: Reply with quote

Thanks a lot for your help mohrt. This one worked for me Idea
_________________
See ya, Lemming
Back to top
View user's profile Send private message Visit poster's website
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