|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Sybux2000 Smarty Rookie
Joined: 27 Feb 2005 Posts: 13
|
Posted: Sat Apr 16, 2005 10:59 pm Post subject: SmartyValidate and html_select_date |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sun Apr 17, 2005 3:47 am Post subject: |
|
|
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 |
|
gestionti Smarty Rookie
Joined: 02 Mar 2005 Posts: 15 Location: Gatineau, Qc, Canada
|
Posted: Wed Jul 20, 2005 4:00 pm Post subject: |
|
|
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 |
|
|
|
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
|