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

smartyValidate criteria usuage {if} {else}

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

Joined: 06 Nov 2004
Posts: 13

PostPosted: Sat Nov 06, 2004 10:44 pm    Post subject: smartyValidate criteria usuage {if} {else} Reply with quote

First off, just like to say, great system. Takes a huge load off of my current project load. Now, to just figure out some basics to get me going.

1. The below code I'm wondering about criteria, can it be left blank or just simply left out? Only operation I'm doing on it is a transform. I don't care about numbers, empty, etc.


        <td align="right">Address (line 2) </td>
        <td valign="top"><input name="schaddline2" type="text" value="{$schaddline2|escape}"></td>
        <td align="center">&</td>
        <td align="center" class="style5">{validate field="schaddline2" criteria="" transform="trim"} </td>

2. The field 'teachphone' can be left blank, but if it's not blank I want to check to see if it's a number. How would I first check to see if its notEmpty then isNumber?
         <td align="right">Phone Number </td>
        <td valign="top"><input name="teachphone" type="text" value="{$teachphone|escape}"></td>
        <td align="center"><span class="style5">*</span></td>
        <td align="center"> { POINT OF QUESTION}</td>
Back to top
View user's profile Send private message
Smarty n00b

Joined: 24 Nov 2004
Posts: 2

PostPosted: Thu Dec 02, 2004 11:09 am    Post subject: check out the README! Reply with quote

ad 1.

{validate field="StartDate" criteria="dummyValid" transform="makeDate"}

"dummyValid": this is a dummy criteria that always validates to true. This is useful to apply a transformation to a field without actually applying a validation.

ad 2.

{validate field="foo" ... empty="yes"}

"empty" determines if the field is allowed to be empty or not. If allowed, the validation will be skipped when the field is empty. Note this is ignored with the "notEmpty" criteria.

Discreet advise: read the README carefully!
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