Hi everyone,
I'm trying to implement a dialog with a couple of radioButtons in one radioButtonGroup. After pressing "Ok" the selected RadioButton-Name should be displayed in the formular.
I can't figure out a way to get the name of the radioButton and pass it to the form.
Here is what i got so far:
commit: function(dialog) {
// i need the radio button name here
},
description:{
name: "Auswahl Schnittstellen",
elements:[
{type: "cluster", name: "ABS", elements:[
{type: "view", align_children: "align_left", elements: [
{type: "radio", name: "name1", group_id: "rado"},
{type: "radio", name: "name2", group_id: "rado"},
{type: "radio", name: "name3", group_id: "rado"},
{type: "radio", name: "name4", group_id: "rado"},
]}
]}
]}...
Hi,
You still need to specify the item_id attribute for the radio buttons, so I would do this like;
function dialog() {
var descriptor = {
commit: function(dialog) {
var elements = dialog.store();
dialogObject.nam1 = elements["nam1"];
dialogObject.nam2 = elements["nam2"];
dialogObject.nam3 = elements["nam3"];
dialogObject.nam4 = elements["nam4"];
},
description:{
name: "Auswahl Schnittstellen",
elements:[
{ type: "ok_cancel" },
{ type: "cluster", name: "ABS", elements:[
{ type: "view", align_children: "align_left", elements: [
{ type: "radio", name: "name1", group_id: "rado", item_id:"nam1" },
{ type: "radio", name: "name2", group_id: "rado", item_id:"nam2" },
{ type: "radio", name: "name3", group_id: "rado", item_id:"nam3" },
{ type: "radio", name: "name4", group_id: "rado", item_id:"nam4" }]}
]}
]}
}
var dialogObject =
{
execDialog: function() { return app.execDialog(descriptor); },
};
return dialogObject;
}
var d = dialog();
d.execDialog();
console.println(d.nam1);
console.println(d.nam2);
console.println(d.nam3);
console.println(d.nam4);
There will only be one of the four set to true, but it's the item_id that returns the value not the group_id.
Regards
Bruce
Hi,
First of all, thanks for your solution! But now i have more that 20 radiobuttons, therefore this solution get quiet confusing. I was hoping there was a possibility to return the group_id and read the selected radiobutton out of its information.
I will try to make it work with your solution, but if you find a way to handle it just with the group_id, i would be curious to hear it!
Thanks in advance!
Views
Replies
Total Likes
Hi,
I am not aware of a way to do this using the dialog object, though there are a lot of undocumented methods and properties some of which are shown here, Adobe LiveCycle Designer Cookbooks by BR001: execDialog
But you should be able to get the result you want with a bit of JavaScript;
function dialog() {
var radioButtonList = [ { type: "radio", name: "name1", group_id: "rado", item_id:"nam1" },
{ type: "radio", name: "name2", group_id: "rado", item_id:"nam2" },
{ type: "radio", name: "name3", group_id: "rado", item_id:"nam3" },
{ type: "radio", name: "name4", group_id: "rado", item_id:"nam4" } ]
var descriptor = {
commit: function(dialog) {
var elements = dialog.store();
var radioButtonIds = radioButtonList.map(function (entry) { return entry.item_id } )
for (var i=0, limit=radioButtonIds.length; i < limit; i++) {
if (elements[radioButtonIds[i]] == true) {
dialogObject.rado = radioButtonIds[i];
break;
}
}
},
description:{
name: "Auswahl Schnittstellen",
elements:[
{ type: "ok_cancel" },
{ type:"cluster", name: "ABS", elements:[
{ type: "view", align_children: "align_left", elements: [
{ type: "static_text", name: "Choose one:" }]
.concat(radioButtonList)
.concat([ { type: "static_text", name: "some more stuff..." } ])
}
]}
]}
}
var dialogObject =
{
rado: null,
execDialog: function() { return app.execDialog(descriptor); },
};
return dialogObject;
}
var d = dialog();
d.execDialog();
console.println(d.rado);
In this example I build up the dialog object with the concat() method, so I can access the item_id in the commit() method.
Regards
Bruce
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies
Views
Likes
Replies