Expand my Community achievements bar.

How to prevent manual data import with dynamic forms?

Avatar

Former Community Member

Hi,

I have a dynamic template which is rendered and filled with data on a server. The only dynamic part which can be used by the user is are tables which might be expanded.

Now I have the issue that when rendered as dynamic form the user has the abililty to import any XML file into the finished document when opened in Adobe Acrobat Reader (Forms --> Manage Form Data --> Import Data).

Can I somehow prevent this? Is it maybe a server render setting or a forms propertie which I did not find yet? Or can I prevent it via Javascript somehow? Any suggestions?

thx in advance

2 Replies

Avatar

Level 7

I am also interested in a solution to this.

Avatar

Level 10

Hi,

Something to try might be to copy your data to a second data set and have your fields bind to those values, then if someone does import data then they are values the form does not look at.

Normally you dataset will look something like (with formData being the root of your data).

<xfa:datasets>

   <xfa:data>

    <formData>

       <a>value a</a>

       <b>value b</b>

       <c>value c</c>

    </formData>

   </xfa:data>

</xfa:datasets>

You could copy this dataset outside of the data node (which is were the importData would go);

<xfa:datasets>

   <formData>

      <a>value a</a>

      <b>value b</b>

      <c>value c</c>

   </formData>

   <xfa:data>

    <formData>

       <a>value a</a>

       <b>value b</b>

       <c>value c</c>

    </formData>

   </xfa:data>

</xfa:datasets>

Your fields would then bind using the expression "!formData.a". 

To copy the dataset,  maybe in the docReady event,  use;

xfa.datasets.loadXML(xfa.datasets.data.formData.saveXML(), false, false);

xfa.form.remerge();

You would have to remerge for the fields to pick up the new dataset.

When it comes time to submit the form you would then have to copy the dataset back.

Maybe to much mucking around?  Hopefully there'll be a server rendering setting but I don't know of one.  If your users are within your organisation you could do a custom install and remove the import data menu item.

Here's a sample I used to test this idea, https://sites.google.com/site/livecycledesignercookbooks/home/SecondDataSet.pdf?attredirects=0&d=1

The preview data for it looks like;

<formData>

<a>value a</a>

<b>value b</b>

<c>value c</c>

</formData>

Regards

Bruce