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

Please help {html_options...} not quite working as it used

 
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 -> Smarty 3
View previous topic :: View next topic  
Author Message
i7
Smarty n00b


Joined: 08 Aug 2019
Posts: 1

PostPosted: Thu Aug 08, 2019 2:04 pm    Post subject: Please help {html_options...} not quite working as it used Reply with quote

Hi,

I've had a bit of the code to record hours e.g. 1.0 1.5 2.0 2.5...:

{html_options values=$hours output=$hours selected=$information[0].r3}

In the old version used to work perfectly and the drop down value was slected correctly based on the value e.g. 2.0 was the same as 2, however in the new version:

If selected value is 2 (not 2.0) the correct value doesn't get selected correctly and I have to add: |string_format:"%.2f"

{html_options values=$hours output=$hours selected=$information[0].r3|string_format:"%.2f"}

now it seems to be doing literal comparison so 1.50 is NOT the same as 1.5.

Is this how it works now?
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Sun Aug 11, 2019 11:41 am    Post subject: Reply with quote

That's to be expected. HTML options values are strings, you have to match the value exactly.
In other words, your old code was wrong and shouldn't have been working.
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 -> Smarty 3 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