I am constructing a dialog in pdf javascript, which contains multiple groups of radio buttons. What i don't get is how to set a default selection for any one group. The example i have attached below is shortened to only one radio button group. I do believe that using a check box for this task would probably be better it is not my decision to make.
function valuesDialog()
{
var oDlg = {
result: "cancel",
DoDialog: function() { return app.execDialog(this); },
complete: false,
commit: function(dialog) {
var result = dialog.store();
this.complete = result["completeTrue"];
},
description: {
name: "ADialog",
elements:
[
{
type: "view",
elements:
[
{
type: "view",
align_children: "align_row",
elements:
[
{
name: "Is complete?",
type: "static_text",
char_width: 15,
},
{
item_id: "completeTrue",
group_id: "complete",
type: "radio", char_width: 15,
name: "Yes"
},
{
item_id: "completeFalse",
group_id: "complete",
type: "radio",
char_width: 15,
name: "No" },
]
},
]
},
{ type: "ok_cancel", },
]
}
};
if(oDlg.DoDialog() == "ok")
{
var result = { complete: oDlg.complete, }
return result;
}
return "failed";
}
I tried checked and selected in various different ways, and couldn't get that to work. Googling resulted in me trying this.getField("completed").value = someIndex;
which also did nothing.
The expected result is that instead of the "Yes" radio button being selected when the dialog opens, the "No" button is selected.
Updated to minimal reproducable. Anyways, i found an answer in the meantime. Adding this block to the oDlg json object seems to have the desired effect. Taken from the adobe jsapi documentation. I currently cannot find a viable link to the pdf I was looking through, since it is saved locally on a company server. If anyone can find a fitting example / actual documentation backing me up, please comment.
initialize: function(dialog)
{
var conf = { "completeFalse": true, };
dialog.load(conf);
},