https://bugzilla.wikimedia.org/show_bug.cgi?id=19832


Brion Vibber <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]




--- Comment #2 from Brion Vibber <[email protected]>  2009-07-19 23:00:48 UTC 
---
Testing with current dev trunk, seems to accept the selected parameter just
fine for me...

> return Xml::listDropDown('name', "a\nb\nc", 'theother', 'b');
<select id="name" name="name">
<option value="other">theother</option><option value="a">a</option><option
value="b" selected="selected">b</option><option value="c">c</option>
</select>

^ option 'b' is selected as expected


> return Xml::listDropDown('name', "a\nb\nc", 'theother', 'other');
<select id="name" name="name">
<option value="other" selected="selected">theother</option><option
value="a">a</option><option value="b">b</option><option value="c">c</option>
</select>

^ option 'other' is selected as expected


A couple notes:

First, in current code the $other parameter doesn't appear to be optional
currently; an "other" option will always be added in the current code. The
patch makes it optional, which may or may not be what's desired in usage.

Second, exact comparisons are used (===), which means if you're using numbers
for your values you might be getting false negatives -- 1 won't match "1" for
instance. Using coercible comparisons (==) will let those through but could
also create false positive matches in some cases, for instance if you're trying
to select between "1" and "01" or something. Not sure we want to introduce a
change here.

Personally I think I'd rather just junk this function and replace it with an
interface that's not awful. ;) Building the option set from a formatted string
is a really nasty interface.


-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to