|
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 |
jerrystar Smarty n00b
Joined: 16 May 2009 Posts: 3
|
Posted: Tue May 26, 2009 4:40 am Post subject: set month and year as selected while submitting the form? |
|
|
{html_select_date prefix='StartDate' time=$time start_year='-5' end_year='+1' display_days=false}
while i am submitting the form
i need to set month and year as selected .How to do this? |
|
Back to top |
|
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Tue May 26, 2009 3:07 pm Post subject: I prefer a trick |
|
|
I prefer a trick of using minmal amount of javascripts - when something is not immediately good enough:
a. You can not use 'selected' parameter.
b. Even if you use it, every loop for <optipn>..</option> needs to be compared - dropping a very little performance.
c. Minimal javascript does not harm.
Do something tricky here, just before </body> in your page:
Code: | <script language='javascript'>
document.forms['formname'].elements['date_year'] = '{$smarty.post.date_year}';
</script> |
First, note down, the name of the year/month/day fields in the form generated by Smarty. Next, add the above javascript with proper name replacement.
Less burden for getting your output, isn't it? |
|
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
|