Community articleUFLReadForm function
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars


This function reads a form into memory from a specified file.


   formNodeP UFLReadForm(
      r_charP theFilePath,
      r_u_long flags);


theFilePathr_charPThe path to the source file on the local disk.
flagsr_u_long0 — no special behavior.
UFL_SERVER_SPEED_FLAGS — This setting significantly improves server processing times. It does that by turning off the following features: computes, automatic formatting, duplicate sid detection, XForms processing, write relevant, the event model, and relative page and item tags (for example, itemprevious, itemnext, and so on).
Note that this setting does not respect XForms relevance.
UFL_SERVER_SPEED_FLAGS_WITH_XFORMS — This setting significantly improves server processing times in the same manner as UFL_SERVER_SPEED_FLAGS, but it does not turn off XForms processing, and it respects XForms relevance.
The remaining flags cause special behaviors. If using multiple flags, combine them using a bitwise OR, AND, or NOT. For example:

UFL_AUTOCOMPUTE_OFF — Reads the form into memory, but disables the compute system so that no computes are evaluated.
UFL_AUTOCREATE_CONTROLLED_OFF — Reads the form into memory, but disables the creation of all options that are maintained only in memory (for example, itemnext, itemprevious, pagenext, pageprevious, and so on).
UFL_AUTOCREATE_FORMATS_OFF — Reads the form into memory, but disables the evaluation of all format options.
UFL_XFORMS_INITIALIZE_ONLY — Turns off UI connection to the XForms model. This flag respects XForms relevance and validity settings, but changes to the XForms model are not reflected in the UI.
UFL_XFORMS_OFF — Turns off XForms processing, including UI connection to the XForms model.


A new formNodeP.


Duplicate Scope IDs
If a form contains duplicate scope IDs (for example, two items on the same page with the same SID), UFLReadForm will fail to read the form and will return an error. This enforces correct XFDL syntax, and eliminates certain security risks that exist when duplicate scope IDs appear in signed forms.
Digital Signatures
When a form containing one or more digital signatures is read, the signatures will be verified. The result of the verification is stored in a flag that can be checked by calling UFLGetSignatureVerificationStatus.
Note that this flag is only set by UFLReadForm, and its value will not be adjusted by changes made to the form after it has been read. This means that calls such as UFLSetLiteralEx may actually break a signature (by changing the value of a signed item), but that this will not adjust the flag's value. To verify a signature after changes have been made to a form, use UFLVerifyAllSignatures.
Server-Side Processing
Using the UFL_SERVER_SPEED_FLAGS setting significantly improves performance during server-side processing. Note that this setting turns XForms processing off. If you need XForms processing to be on, use UFL_SERVER_SPEED_FLAGS_WITH_XFORMS.
If you find that you need some but not all of the functionality of UFL_SERVER_SPEED_FLAGS, you can turn off these flags as shown in the Server-Side Processing usage note, above.
Using UFLUpdateXFormsInstance and UFLExtractXFormsInstance with UFL_SERVER_SPEED_FLAGS
You can modify an XForms instance with UFLUpdateXFormsInstanceUFLReadFormUFLExtractXFormsInstance


In the following example, UFLReadForm is used to load a form from a file on the local disk.
   r_error loadForm(formNodeP *form)
      if ((*form = UFLReadForm("sample.xfd", 0)) == NULL)
         fprintf(stderr, "Could not load form.\n");

Parent topic:
XFDL functions