summaryrefslogtreecommitdiffstats
path: root/install/ui/widget.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-09-30 21:25:47 -0500
committerMartin Kosek <mkosek@redhat.com>2011-10-05 15:08:07 +0200
commite9c8581ffcd4a43c4e812037a076967e0d968261 (patch)
tree5085096b8b73ce3b5f4ffee556266759fa17ee0c /install/ui/widget.js
parentc76bbd5129c42b2fbce81e4621f160443b2dcb67 (diff)
downloadfreeipa.git-e9c8581ffcd4a43c4e812037a076967e0d968261.tar.gz
freeipa.git-e9c8581ffcd4a43c4e812037a076967e0d968261.tar.xz
freeipa.git-e9c8581ffcd4a43c4e812037a076967e0d968261.zip
Added selectable labels for radio buttons.
The radio buttons in association facet and radio widget are now linked to their labels so that they can be selected by clicking the labels. Ticket #1782
Diffstat (limited to 'install/ui/widget.js')
-rw-r--r--install/ui/widget.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/install/ui/widget.js b/install/ui/widget.js
index b25dc8f7..7acaf9a3 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -936,13 +936,23 @@ IPA.radio_widget = function(spec) {
for (var i=0; i<that.options.length; i++) {
var option = that.options[i];
+ // TODO: Use ID generator or accept ID from spec to avoid conflicts.
+ // Currently this ID is unique enough, but it will not work if the
+ // radio button is used multiple times for the same attribute, for
+ // example both in adder dialog and details facet.
+ var id = that.entity.name+'-'+that.name+'-'+i+'-radio';
+
$('<input/>', {
- 'type': 'radio',
- 'name': that.name,
- 'value': option.value
+ id: id,
+ type: 'radio',
+ name: that.name,
+ value: option.value
}).appendTo(container);
- container.append(option.label);
+ $('<label/>', {
+ text: option.label,
+ 'for': id
+ }).appendTo(container);
}
if (that.undo) {