Use javascript to access field value in form.

1
0
-1

I have a simple workflow that calls an external QC system to validate a file. Once the file is validated I make a call to get a base64 string which contains the PDF report for the file.

I have created a connector that calls the external QC system and loads the PDF Base 64 string into a process variable called pdfReport.

Now I want to use javascript to render the PDF report from a form inside of Bonita.

I have created a text field that is bound to the pdfReport variable. I can see the encoded data in the form when I run the workflow. I noticed that the field does not have an id attribute so I added one under options/HTML attributes.

I have created a simple button with some javascript that should render the report. Here is the javascript under options/HTML attributes for the button:

onclick='window.open("data:application/pdf;base64 ", + document.getElementById("ReportData").value)';

When I run the workflow and click the button I get this error in the Firebug console:

TypeError: $doc.getElementById(...) is null

....$.popup.open();b=$doc.getElementById('popupcontainerheader');pu(b,Rie);bu(b,vpc...

It looks like my javascript is being modified by the Bonita engine. Any suggestions?

1 answer

1
0
-1

Hello,

Did you try to put your script into a HTML widget, then in the html atrtibute call your method.

I hope it was usefull to you.

Nicolas

Comments

Submitted by ryan.dever on Wed, 04/02/2014 - 17:48

I have but I get the same results. I added a HTML widget to the form and added this function:

I then changed the onclick in the simple button to invoke the function. The error message in Firebug is unchanged.

Notifications