Hi all,

Any reason why select() doesn't support taking disabled as a keyword
args like the other input tags?  Is something like the below desirable?
(Not actually very tested...)

Thanks,
Ross

diff -r acfb17881c1c webhelpers/html/tags.py
--- a/webhelpers/html/tags.py   Thu Mar 24 02:23:48 2011 -0700
+++ b/webhelpers/html/tags.py   Tue Jul 19 18:19:39 2011 -0400
@@ -343,12 +343,17 @@
       list: ("", ``prompt``).  This is intended for those "Please choose ..."
       pseudo-options.  Its value is "", equivalent to not making a selection.
 
+    * ``disabled`` - If set to True, the user will not be able to use
+        this input.
+
     Any other keyword args will become HTML attributes for the <select>.
 
     Examples (call, result)::
     
         >>> select("currency", "$", [["$", "Dollar"], ["DKK", "Kroner"]])
         literal(u'<select id="currency" name="currency">\\n<option 
selected="selected" value="$">Dollar</option>\\n<option 
value="DKK">Kroner</option>\\n</select>')
+        >>> select("currency", "$", [["$", "Dollar"], ["DKK", "Kroner"]], 
disabled=True)
+        literal(u'<select disabled="disabled" id="currency" 
name="currency">\n<option selected="selected" 
value="$">Dollar</option>\n<option value="DKK">Kroner</option>\n</select>')
         >>> select("cc", "MasterCard", [ "VISA", "MasterCard" ], id="cc", 
class_="blue")
         literal(u'<select class="blue" id="cc" name="cc">\\n<option 
value="VISA">VISA</option>\\n<option selected="selected" 
value="MasterCard">MasterCard</option>\\n</select>')
         >>> select("cc", ["VISA", "Discover"], [ "VISA", "MasterCard", 
"Discover" ])
@@ -364,6 +369,7 @@
     _set_id_attr(attrs, id, name)
     attrs["name"] = name
     convert_boolean_attrs(attrs, ["multiple"])
+    convert_boolean_attrs(attrs, ["disabled"])
     # Accept None as selected_values meaning that no option is selected
     if selected_values is None:
         selected_values = ('',)

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to