We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to update field properties and values programmatically?

Hi,

I am following the tutorial on this page but it is not working:

https://ej2.syncfusion.com/javascript/documentation/pdfviewer/form-designer/create-fillable-PDF-forms/create-programmatically/

I use this command to update the isReadonly property of a field (doesn't work):

pdfviewer.formDesignerModule.updateFormField(pdfviewer.formFieldCollections[0], { isReadonly: true } );

I use this command to update value of a field (doesn't work):

pdfviewer.formDesignerModule.updateFormField(pdfviewer.formFieldCollections[0], { value: "Hello" } );

What am I doing wrong?

Thank you very much!


3 Replies 1 reply marked as answer

CK Chinnamunia Karthik Chinna Thambi Syncfusion Team October 6, 2022 03:22 AM

Hi Pere,

 

Kindly refer to the below sample to update the form field properties and values programmatically.

 

Code Snippet:

 

To update the read-only property

 

pdfviewer.formDesignerModule.updateFormField(pdfviewer.formFieldCollections[0], { isReadOnly: true } );

To update the value of a form field

 

pdfviewer.formDesignerModule.updateFormField(pdfviewer.formFieldCollections[0], { value: "Hello" } );

 

Sample: https://stackblitz.com/edit/qmwsbk?file=index.html,index.js



Regards,
CCM Karthik


Marked as answer

PA Pere Argelich Romà replied to Chinnamunia Karthik Chinna Thambi October 7, 2022 11:10 AM

Hi Chinnamunia,

Now works fine!!

Thank you very much!



CK Chinnamunia Karthik Chinna Thambi Syncfusion Team October 10, 2022 01:34 AM

Hi Pere,

 

Thank you for your updates. We are closing this ticket now. Kindly reopen this ticket, if you have any concerns on this.



Regards,
CCM Karthik


Loader.
Live Chat Icon For mobile
Up arrow icon