Christopher Nelson wrote: > As I work on polishing http://trac.edgewall.org/ticket/10983 for Trac > 1.0.1, I find that radio button attributes are not handled correctly. > What I believe I'm seeing is that stock Trac 1.0.1 shows a radio-type > filter with checkboxes. > > Looking at trac/htdocs/js/query.js, I find > > if (property.type == "radio") { > for (var i = 0; i < property.options.length; i++) { > var option = property.options[i]; > var control = createCheckbox(propertyName, option, > > and > > } else if (property.type == "checkbox") { > focusElement = createRadio(propertyName, "1", propertyName + > "_on"); > > Huh? If the property is a radio button display a checkbox (and vice > versa)?
Yes, that code is confusingly correct ;) This is part of the code handling the query form. A field with type "radio" can have one value out of a set of possible values. When querying, you want to include any number of values out of the set. This is done by showing one checkbox for each value in the set, and you can check the values that you want to include. Conversely, a field with type "checkbox" can have only two values: checked or unchecked. So when you query, it only makes sense to choose one or the other (if you want both, you just remove the constraint on that field from the form, and you can never have both). Selecting one alternative out of two is done with two radio buttons. It could also be done with a single checkbox, it would be more confusing (with radio buttons, you can attach a label to each). So yeah, working as intended. -- Remy
signature.asc
Description: OpenPGP digital signature
