Uncheck all radio buttons in PDF before print in JavaScript

461 views Asked by At

In my PDF form I've got some radio buttons checked by default and I need to make them unchecked before printing the form.

I've tried this but it didn't seem working:

function deleteDefault()
{
    for (let x of this.getElementsByClassName("radio")){
        x.checked = False;}
}
function deleteDefault()
{
    var x = this.getElementsByClassName("radio");
    var i;
    for (i = 0; i < x.length; i++){
        x[i].checked = False;}
}

I even tried to uncheck one after another like so:

function deleteDefault()
{
    this.getField("FieldName").checked = False;
}

.. but that didn't work nether.

Can someone please tell me where I'm making a mistake? Thank you all, I'm just getting started with JavaScript

1

There are 1 answers

0
krusovaa On BEST ANSWER

I figured it out this way:

this.getField("FieldName").value = "Disapproved";

That works for a radio button.

For list box or simple text box this works just fine:

this.getField("FieldName").value = "";