RE: [SMARTY] controlling/preserving selected values from html_select_date

From: Date: Sun, 01 Jun 2003 18:59:43 +0000
Subject: RE: [SMARTY] controlling/preserving selected values from html_select_date
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9634@lists.php.net to get a copy of this message
Thanks Onno for the quick reply but that's not what I am looking for. The "prefix" attribute just prefixes the select names, for ex if you use prefix as ==> xxx {html_select_date field_order="DMY" month_format="%m" start_year=-80 end_year=-10 field_separator=" / " all_extra="class='selectbox'" reverse_years="yes" prefix="xxx"} you get : <select name="xxxDay" class='selectbox'>...... <select name="xxxMonth" class='selectbox'>...... <select name="xxxYear" class='selectbox'> What I am looking for is to have any option item in select box as selected.... Maybe I was not very clear, for example imagine a registration form with simple fields : Login Name : ==> textbox Password ==> textbox Sex ===> radio [male/female] BirthDay ===> html_select_date ....... if a user chooses an already registered login name, I show the same form again with an error message like "this name is taken, please choose another login name" but from usability point of view I also populate the fields with the ones the user has entered beforehand so that he doesn't have to input them all again [to avoid user frustration] I can easily fill values of textboxes/radions what the user has filled in the 1st screen by getting/using the values of texboxes, radios etc... But for html_select_date there is no "selected" attribute so that I can have previously selected dates as selected. If I use html_options, I can have anyting selected by using "selected" attribute of html_options. But this defeats the purpose of using html_select_date then ... Why should I use html_select_date if I cannot control which values are selected initially ? Maybe not having the ability to select values for printing in html_select_box can be seen as a bug or needs an improvement ? I don't know. I just wondered what other users have been dealing with a similar situation because I'm sure this should be a very common need [ability to have desired options in html_select_box as selected........] Regards, Irfan Uygur >>> -----Original Message----- >>> From: Onno Timmerman [mailto:onno.timmerman@s-p-a.be] >>> Sent: 31 Mayys 2003 Cumartesi 21:22 >>> To: irfan@pusulanet.com.tr >>> Subject: Re: [SMARTY] controlling/preserving selected values from >>> html_select_date >>> >>> >>> I'm not sure but in the manual >>> >>> http://smarty.php.net/manual/en/language.function.html.selec t.date.php >>> wich is good writen you can state "prefix" >>> The defaults are Date_Day, Date_Month, Date_Year. >>> You could send it to the URL... >>> Is that where you looking for? >>> >>> Onno >>> >>> Irfan Uygur wrote: >>> >>> >Hi everbody, >>> > >>> >I've recently started[discovered] using Smarty and I think >>> it's great, really cuts down the development time. >>> >However I've stumbled upon one problem with >>> html_select_date function: >>> > >>> >I want to control which values are selected from >>> html_select_date , especially when dates are only a part of >>> my registration screen. >>> >In case a user makes a mistake [for ex login name already >>> created by another user] I show the same screen again , and preserve >>> >the values of previously filled values [for ex: sex, >>> location etc.] But it seems like there is no option to >>> control the values for >>> >html_select_date >>> >options. In "html_options" function I can control/preserve >>> previously selected values by using the "selected" attribute, >>> >but it seems like there is no option for html_select_date. >>> Did anyone find a solution for this already ? Or should I convert my >>> >html_select_date >>> >to html_options, but this defeats the purpose for using >>> html_select_date .... >>> > >>> >Thanks in advance, >>> > >>> >Regards, >>> >Irfan Uygur >>> > >>> > >>> > >>> > >>> > >>> >>> >>> >>>

« previous php.smarty.general (#9634) next »