|
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 |
novus Smarty Rookie
Joined: 17 Nov 2003 Posts: 7
|
Posted: Tue Dec 28, 2004 4:35 pm Post subject: |
|
|
wow that was fast.
i dont want to assign a variable from php i want do it directly in the template.
Code: | {html_select_date prefix="dateFrom" time="-4 years" start_year="-4 years"|date_format:"%Y" display_days=false} |
the code above wont work. on the site years from 2000-2004 are in the box but the selected year is still 2004. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Dec 28, 2004 4:42 pm Post subject: |
|
|
I did that wrong, ignore my previous post
Actually, your original code should work:
{html_select_date prefix="dateFrom" time="-4 years" start_year="-4" display_days=false}
This should output:
Code: | <select name="dateFromMonth">
<option label="January" value="01">January</option>
<option label="February" value="02">February</option>
<option label="March" value="03">March</option>
<option label="April" value="04">April</option>
<option label="May" value="05">May</option>
<option label="June" value="06">June</option>
<option label="July" value="07">July</option>
<option label="August" value="08">August</option>
<option label="September" value="09">September</option>
<option label="October" value="10">October</option>
<option label="November" value="11">November</option>
<option label="December" value="12" selected="selected">December</option>
</select>
<select name="dateFromYear">
<option label="2000" value="2000" selected="selected">2000</option>
<option label="2001" value="2001">2001</option>
<option label="2002" value="2002">2002</option>
<option label="2003" value="2003">2003</option>
<option label="2004" value="2004">2004</option>
</select>
|
Be sure to hold down the shift key when you reload your browser after template changes, I know firefox likes to keep the last selected form values on a normal reload. If that doesn't work, be sure caching is turned off and compile_check is on. |
|
Back to top |
|
novus Smarty Rookie
Joined: 17 Nov 2003 Posts: 7
|
Posted: Tue Dec 28, 2004 5:31 pm Post subject: |
|
|
my code was working it was the cache in firefox. damn.
thanks for your help |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Dec 28, 2004 5:37 pm Post subject: |
|
|
This is something I encounter during application development a LOT, it can be frustrating. I noticed that if you change the default value on a form and reload it in Firefox, it will retain the values that were selected before the reload, regardless of the default value in the form. At first I thought this was a bug but noticed that it went unfixed release after release. Only after digging through the debug database did I find that this was done intentionally. Example, if you're on a web page and filled out a huge form and then hit reload, it will retain all the filled in data instead of reverting to the default values. So if you change your form templates, always shift-reload. |
|
Back to top |
|
senthilkumar Smarty n00b
Joined: 22 Jan 2005 Posts: 3
|
Posted: Sat Jan 22, 2005 9:55 pm Post subject: |
|
|
{html_select_date time="2005/12/20"} you can use like that for selected date |
|
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
|