Free Support Forum - aspose.com

Hide/show Javascript fields inside Swissmedic Materio form

We are unable to show/hide fields inside a pdf that uses javascript.

The form uses Javascript to show some fields, depending on the clicked value. We want to do the same thing inside our code.

When we open des PDF form with “BindPdf”, the FieldList ist empty:
pdfForm.Document.Form.Fields

The field on the right is one of the fields we like to display (including the labels right and left from it)
image.png (17.3 KB)
The two field identifiers:
incident[0].Seite1[0].InfoHersteller[0].Info_Hersteller[0]
incident[0].Seite1[0].InfoHersteller[0].wann[0]

The PDF:
MEP_Vigilance_Meldung_de.PDF (1.8 MB)

@newwin-sws

We tested the scenario in our environment using the below code with Aspose.PDF for .NET 21.4 and noticed that the JavaScript was disabled in the output PDF:

Document doc = new Document(dataDir + "MEP_Vigilance_Meldung_de.pdf");
if (doc.Form.Type == FormType.Dynamic && (doc.Form.XFA != null) && doc.Form.XFA.FieldNames.Count() > 0)
{
 doc.Form.XFA["incident[0].Seite1[0].InfoHersteller[0].Info_Hersteller[0]"] = "0";
 doc.Form.XFA["incident[0].Seite1[0].InfoHersteller[0].wann[0]"] = "1";
}
doc.Save(dataDir + "XFAPDF.pdf");

Therefore, we have logged an issue as PDFNET-49870 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.