Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This is often needed when you need to relate an  form with another concept your application (e.g. you application has the concept of a report that has an associated  form). In this case you will store the form id somewhere and when needed fetch the form entry to embed it in your page, delete it, etc.
Here  Here is how you get the for a form entry (in fact any entry):

Code Block
    FormTypeEntry ftEntry = ...;
    String formId = ftEntry.getId();

And

...

here

...

is

...

how

...

you

...

can

...

use

...

that

...

id

...

to

...

find

...

the

...

corresponding

...

form

...

entry:

Code Block
    String formId = ...;
    FormsService fs = ...;
    URL formEntryUrl = fs.getEntryURL(FormTypeEntry.class, formId);
    FormTypeEntry ftEntry = fs.getEntry(formEntryUrl, FormTypeEntry.class);

...

Code Block
    FormsService fs = ...;
    ApplicationEntry appEntry = ...; // find app entry
    FormTypeEntry ftEntry = ...; // find template form entry 
    MediaContent mc = (MediaContent) ftEntry.getContent();
    MediaSource ms = getService().getMedia(mc);
    OutputStream formStream = new FileOutputStream("myform_form.zip");
    saveFormToDisk(ms.getInputStream(), formStream);

How do I upload

...

a form into an existing application?

You can also upload a form that was previously downloaded using the following code snippet:

...