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

Problem mit html_options

 
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 -> Language: German
View previous topic :: View next topic  
Author Message
McSodbrenner
Smarty Pro


Joined: 19 Sep 2004
Posts: 101
Location: Hamburg, Germany

PostPosted: Tue Dec 21, 2004 12:54 pm    Post subject: Problem mit html_options Reply with quote

Hi,
ich weiß jetzt nicht, ob das ein Problem von Smarty oder ein Problem mit der automatischen Typkonvertierung von PHP ist...
also ich benutze html_options und dieses ist die Ausgabe, wenn ich selected="3.1" habe:

Code:

<select name="relay" onchange="forms[0].submit();">
<option label="1.1" value="1.1">1.1</option>
<option label="2.1" value="2.1">2.1</option>
<option label="2.2" value="2.2">2.2</option>
<option label="2.3" value="2.3">2.3</option>
<option label="2.4" value="2.4">2.4</option>
<option label="3.1" value="3.1" selected="selected">3.1</option>
<option label="3.2" value="3.2">3.2</option>
<option label="3.3" value="3.3">3.3</option>
<option label="3.4" value="3.4">3.4</option>
<option label="3.5" value="3.5">3.5</option>
<option label="3.6" value="3.6">3.6</option>
<option label="3.7" value="3.7">3.7</option>
<option label="3.8" value="3.8">3.8</option>
<option label="3.9" value="3.9">3.9</option>
<option label="3.10" value="3.10" selected="selected">3.10</option>
<option label="3.11" value="3.11">3.11</option>
<option label="3.12" value="3.12">3.12</option>
<option label="3.13" value="3.13">3.13</option>
<option label="3.14" value="3.14">3.14</option>
<option label="3.15" value="3.15">3.15</option>
<option label="3.16" value="3.16">3.16</option>
</select>


Seltsamerweise werden also bei "3.1" (und bei diesem Array auch nur dieser Wert) als "selected" zwei Einträge markiert. Liegt das an der autopmatischen Typkonvertierung? Theoretisch müsste man das doch im Plugin ausmerzen können, oder?
_________________
Grüzi, Smile
Christoph

My sweet home: www.webboarder.de
Do not visit!! It is private!! And it's mine!
Back to top
View user's profile Send private message Visit poster's website
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Dec 22, 2004 12:30 pm    Post subject: Reply with quote

ja, da f***t dich grade die tolle automatische typ-konvertierung von php. Sad

in function.html_options.php (in zeile 101 in der 2.6.6-release) ist ein check:
if (in_array((string)$key, $selected))
den könntest du ändern in
if (in_array((string)$key, $selected, true))

ich möchte wetten, dass dein "selected" dann korrekt funktioniert.

leider ist das dann nicht kompatibel zu den leuten, die sich auf die typkonvertierung verlassen und kann deshalb nicht mal eben in der nächsten release geändert werden

ich frag mich ob html_options durch ein select_strict ö.ä. flag erweitert werden sollte.

gruß
messju
Back to top
View user's profile Send private message Send e-mail Visit poster's website
McSodbrenner
Smarty Pro


Joined: 19 Sep 2004
Posts: 101
Location: Hamburg, Germany

PostPosted: Wed Dec 22, 2004 1:11 pm    Post subject: Reply with quote

Hmm, will besser nicht bei den Standard-Plugins herumschrauben, weil ich mich beim nächsten Update bestimmt nicht mehr daran erinnern kann... und wupps, ist die Seite futsch! Very Happy
Hab jetzt die "value"s mit einem Komma statt einem Punkt versehen, somit ist es ein String und kein Integer mehr.

Vielen Dank für deine Antwort!
_________________
Grüzi, Smile
Christoph

My sweet home: www.webboarder.de
Do not visit!! It is private!! And it's mine!
Back to top
View user's profile Send private message Visit poster's website
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 -> Language: German 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