Change or remove form fields tooltips

I'm importing data to PDF Viewer. In this case backbroudColor property is working but tooltip never change.

const importData = (jsonData) => {
if (pdfViewerRef.current && currentDocumentsPath) {
try {
const formFields = pdfViewerRef.current.retrieveFormFields();

formFields.forEach((field) => {
const data = jsonData[field.name];
const updateObj = { tooltip: "", backgroundColor: "#dde4ff" };

if (field.type === "Checkbox") {
updateObj.isChecked = data === true || data === "true";
} else {
updateObj.value = data !== undefined ? data : field.value;
}

pdfViewerRef.current.formDesignerModule.updateFormField(field, updateObj);
});

} catch (error) {
console.error("Error importing form fields", error);
}
}
};

3 Replies

CK Chinnamunia Karthik Chinna Thambi Syncfusion Team September 18, 2024 04:49 PM UTC

Hi Manuel,

We were able to change the tooltip values, and we have provided the code snippet and sample below for your reference.

 

Code snippet:

 

const updateBackgrounAndTooltip = () => {

    if (pdfViewerRef) {

        try {

            const formFields = pdfViewerRef.retrieveFormFields();

            formFields.forEach((field) => {

                const updateObj = { tooltip: field.name, backgroundColor: '#dde4ff' };

                pdfViewerRef.formDesignerModule.updateFormField(field, updateObj);

            });

        } catch (error) {

            console.error('Error importing form fields', error);

        }

    }

};

 

Sample: TooltipSample

 

Run the sample. Hover over the form fields; the tooltip is initially not available. Click the `UpdateBackgroundAndTooltip` button to update the background and tooltip values, and then hover over the form fields again to see the tooltip.

 

Note: We were unable to remove the form field tooltip programmatically. We will validate this and provide further details within two business days, by September 20, 2024.



CK Chinnamunia Karthik Chinna Thambi Syncfusion Team September 20, 2024 11:39 AM UTC

Hi Manuel,

We have logged this as a defect as "Programmatically removing form field tooltip is not working" and will include the fix in our weekly NuGet release, which is estimated to be available on October 15, 2024. You can track the status of the issue through the following link.

 

Feedback link: Programmatically removing form field tooltip is not working | Issue Feedback

 

Disclaimer: "Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization."



US Umamageshwari Shanmugam Syncfusion Team October 15, 2024 11:55 AM UTC

Hi Manuel,


We have fixed the reported issue "Programmatically removing form field tooltip is not working" and the fix for the reported issue was included in our latest weekly release v27.1.53. Kindly upgrade to that version to get the issue resolved.

 

Root cause:

Since the tooltip is empty when updating in the formfieldpropertychange method the condition gets skipped for the tooltip.

 

Solution:

 To fix this issue should check the nullorundefined condition for the tooltip. Then the tooltip gets updated properly.
 

Packages:  

 

CDN Links:

https://cdn.syncfusion.com/ej2/27.1.53/dist/ej2.min.js

https://cdn.syncfusion.com/ej2/27.1.53/material.css

https://cdn.syncfusion.com/ej2/27.1.53/dist/ej2-pdfviewer-lib/pdfium.js

https://cdn.syncfusion.com/ej2/27.1.53/dist/ej2-pdfviewer-lib/pdfium.wasm



Loader.
Up arrow icon