Change CheckBox value

Posted by: moshek on 7 April 2025, 9:27 am EST

  • Posted 7 April 2025, 9:27 am EST

    How can i change with javascript , CheckBox Field value in DsPdfViewer ?

  • Posted 7 April 2025, 11:49 pm EST - Updated 7 April 2025, 11:55 pm EST

    Hi,

    It is possible to change the state of the checkbox field value in DsPdfViewer through JavaScript code. Please refer to the code snippet below that illustrates the same:

    viewer.annotations.then(function (data) {
        data.forEach(pageData => {
            for (let annotation of pageData.annotations) {
                if (annotation.annotationType === 20 && annotation.checkBox) {
                    if (annotation.fieldValue === "Off") annotation.fieldValue = "Yes";
                    else annotation.fieldValue = "Off";
                    viewer.updateAnnotation(pageData.pageIndex, annotation);
                }
            }
        });
    });
    

    You can further refer to the attached code sample that uses the above code snippet and modifies the checkbox field value (see below).

    Please feel free to reach out if you require additional guidance.

    Regards,

    Prabhat Sharma.

    ChangeCheckboxValue.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels