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

html_select_date - nothing preselected

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


Joined: 29 Jun 2005
Posts: 10

PostPosted: Thu Dec 15, 2005 12:17 am    Post subject: html_select_date - nothing preselected Reply with quote

I don't want to have the current time preselected. I can't find a way to make this happen. It always preselects the current time no matter what I have tried.

I am creating an events calendar and each event has a start date/time and an end date/time. However, an end date/time is not required. However, with the current way html_select_date works, you cannot allow for an empty value to leave blank.
Back to top
View user's profile Send private message
TGKnIght
Smarty Junkie


Joined: 07 Sep 2005
Posts: 580
Location: Philadelphia, PA

PostPosted: Fri Dec 16, 2005 2:54 pm    Post subject: Reply with quote

Try something like this :

Code:

{html_select_date prefix="do_DepartureDate" end_year="+5" field_separator="/" time=$do_DepartureDate|default:"-00-00" all_empty="--"}


This should default the field to --/--/----
Back to top
View user's profile Send private message Visit poster's website
sccr410
Smarty Rookie


Joined: 29 Jun 2005
Posts: 10

PostPosted: Fri Dec 16, 2005 5:35 pm    Post subject: Reply with quote

Thanks, worked perfect.

Is there a method to do this with html_select_time as well? I tried the same thing and it caused errors. I guess html_select_time isn't written the same way.
Back to top
View user's profile Send private message
sccr410
Smarty Rookie


Joined: 29 Jun 2005
Posts: 10

PostPosted: Fri Dec 16, 2005 6:05 pm    Post subject: Reply with quote

Nevermind, I altered the html_select_time function to allow for all_empty just like html_select_date
Back to top
View user's profile Send private message
TGKnIght
Smarty Junkie


Joined: 07 Sep 2005
Posts: 580
Location: Philadelphia, PA

PostPosted: Fri Dec 16, 2005 6:48 pm    Post subject: Reply with quote

After some fooling around it appears that you are correct, there is not a way to have a blank time field...

Here is an idea though... leave the {html_select_time} as is with whatever time is in there...

When you are performing your database operation, check the field for date, and if it = 00-00-0000 then do not insert a time, or alter the time insert to be all 0's as well.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General 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