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

html_select_date with option for a single selectbox

 
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 -> Feature Requests
View previous topic :: View next topic  
Author Message
cybot
Smarty Regular


Joined: 20 Apr 2005
Posts: 83

PostPosted: Wed Apr 20, 2005 2:50 pm    Post subject: html_select_date with option for a single selectbox Reply with quote

it would be nice if html_select_date can be called like this:

{html_select_date start=$smarty.now order='reverse' count=5 single=true}

would produce something like this:

<option value="2005-04-11">2005-04-11</option>
<option value="2005-04-10">2005-04-10</option>
<option value="2005-04-09">2005-04-09</option>
<option value="2005-04-08">2005-04-08</option>
<option value="2005-04-07">2005-04-07</option>
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Wed Apr 20, 2005 3:10 pm    Post subject: Reply with quote

You can't get them all in a single dropdown box (there would be WAY too many of them in many cases), you can supply your dates from PHP and use {html_options} to display them.
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 Apr 20, 2005 3:19 pm    Post subject: Reply with quote

Adding that feature wouldn't be easy, it really changes the behavior of the dropdown. What if you wanted this (by months, not days):

<option value="2005-04">2005-04</option>
<option value="2005-03">2005-03</option>
<option value="2005-02">2005-02</option>

or this (different format):

<option value="200504">Apr 2005</option>
<option value="200503">Mar 2005</option>
<option value="200502">Feb 2005</option>
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Wed Apr 20, 2005 3:57 pm    Post subject: Reply with quote

It is hard to get around the fact that multiple html drop-downs are an expediant but rather clumsy way to provide date controls.

If you can afford javascript at your site and for your users, I find this to be very useful: http://www.phpinsider.com/smarty-forum/viewtopic.php?t=3853
Back to top
View user's profile Send private message
cybot
Smarty Regular


Joined: 20 Apr 2005
Posts: 83

PostPosted: Wed Apr 20, 2005 3:59 pm    Post subject: Reply with quote

mohrt wrote:
You can't get them all in a single dropdown box (there would be WAY too many of them in many cases), you can supply your dates from PHP and use {html_options} to display them.


there should be a paramter 'start' and 'end' or 'count'
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Wed Apr 20, 2005 4:07 pm    Post subject: Reply with quote

cybot wrote:
there should be a paramter 'start' and 'end' or 'count'


All of the days and months are always shown. As for the year, you can already do that with start_year="-5", end_year="+5", etc.
Back to top
View user's profile Send private message Visit poster's website
cybot
Smarty Regular


Joined: 20 Apr 2005
Posts: 83

PostPosted: Wed Apr 20, 2005 4:08 pm    Post subject: Reply with quote

boots wrote:
It is hard to get around the fact that multiple html drop-downs are an expediant but rather clumsy way to provide date controls.


normally, but i will only provide about ten dates, this is usefull for many things, for example a callback formular, there you need no dates which are weeks in the future

boots wrote:

If you can afford javascript at your site and for your users, I find this to be very useful: http://www.phpinsider.com/smarty-forum/viewtopic.php?t=3853


no, not rellay god, the app is good but WAI prevents me from using this!
Back to top
View user's profile Send private message
cybot
Smarty Regular


Joined: 20 Apr 2005
Posts: 83

PostPosted: Wed Apr 20, 2005 4:10 pm    Post subject: Reply with quote

mohrt wrote:
All of the days and months are always shown. As for the year, you can already do that with start_year="-5", end_year="+5", etc.


i know, but this doesnt helps me!
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Wed Apr 20, 2005 4:23 pm    Post subject: Reply with quote

[php:1:652e611819]
$start_date = time();
$count = 5;
for($x=0; $x<$count; $x++) {
$smarty->append('dates', strftime("%Y-%m-%d", $start_date + 86400 * $x));
}
[/php:1:652e611819]

Code:
{html_options values=$dates output=$dates}


you can control the format too:

Code:
{html_options values=$dates|date_format:"%Y%m%d" output=$dates|date_format:"%B %e, %Y"}
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Wed Apr 20, 2005 4:49 pm    Post subject: Reply with quote

cybot wrote:
the app is good but WAI prevents me from using this!


hmmm....then the WAI is terribly broken. If tools that make things easier (and provide familiar metaphors) don't make interaction more accessible, I don't know what does. Then again, I don't recall the WAI explicitly saying that JS can't be used -- but rather that alternates must also be provided.

Anyway, this is just my little opinion, so fairly worthless since I mainly deliver my apps on intranets Smile
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 -> Feature Requests 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