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 and html_select_date

 
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 -> Plugins
View previous topic :: View next topic  
Author Message
Sybux2000
Smarty Rookie


Joined: 27 Feb 2005
Posts: 13

PostPosted: Sat Apr 16, 2005 10:59 pm    Post subject: SmartyValidate and html_select_date Reply with quote

Hi,

i'm using {html_select_date} method to generate a calendar. All is working fine in my application and now, I want to add some field control.

I've written the following code but it fails and I don't know why :

test.php
Code:

if (! empty($_POST)) {
       SmartyValidate::connect($smarty);
       if (SmartyValidate::is_valid($_POST)) {
...
} else {
       SmartyValidate::connect($smarty, true);
       SmartyValidate::register_validator('testdate','startdate:enddate', 'isDateBefore');
}


test.tpl
Code:
<form method="post" action="test.php">
Start Date : {html_select_date time=$startdate end_year="+2" field_order="DMY" field_array="startdate"}{validate id="testdate" message="Date is invalid"|validation_error_msg}<br>
End Date :{html_select_date end_year="+2" time=$enddate field_order="DMY" field_array="enddate"}


Some help would be great.
Thx
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Sun Apr 17, 2005 3:47 am    Post subject: Reply with quote

the date validation doesn't work with field_array, only prefix. you'll have to adjust the validator plugin to work with that.
Back to top
View user's profile Send private message Visit poster's website
gestionti
Smarty Rookie


Joined: 02 Mar 2005
Posts: 15
Location: Gatineau, Qc, Canada

PostPosted: Wed Jul 20, 2005 4:00 pm    Post subject: Reply with quote

I have a similar problem. I can't get any of the isDate... criteria to work.

I have a list of validation criterias in service.php:

function register($Year_Start,$Year_End,$date1,$date2,$date3,$date4){
SmartyValidate::register_validator('email_empty','email_adress','notEmpty');
SmartyValidate::register_validator('event_empty','event','notEmpty');
SmartyValidate::register_validator('selected_year_id_1_range',"selected_year_id_1:$Year_Start:$Year_End",'isRange');
SmartyValidate::register_validator('date1_before_date2', '$date1:$date2', 'isDateBefore');

Then in service.tpl :
{validate id="date1_before_date2" message="blah blah" append="errors"}

Whatever date I put whether it comes from my drop down box or even tried hard coded, I keep getting the error message. Others like notEmpty or isRange work fine.

Can anyone give me a hint. Thanks.

Mario
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 -> Plugins 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