Community articleUFLCheckValidFormats function
Added by IBM contributorIBM on August 16, 2011
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.



Description

This function checks the format of either all items on the form or all items on a single page. It returns a list of items that have non valid formats.

Function

   r_error UFLCheckValidFormats(
      formNodeP theNode, 
      formNodeP **returnPtr,
      r_long *returnSizePtr
   );


Parameters

Table 1. Function parameters
ExpressionTypeDescription
theNode formNodePThe node to check.
returnPtr formNodeP**A pointer that is set to store an array of nodes that represent items with non valid formats.
returnSizePtrr_long*A pointer that is set with the size of the return.


Returns

OK on success or an error code on failure.

Example

The following function takes the root node of the form as input, calls UFLCheckValidFormats, then displays a message for each non valid node that it finds.
r_error checkFormats(formNodeP theForm);
{
   formNodeP *invalidItems;
   r_long i, invalidItemsSize; 
   r_error error; 
   r_charP theReference, theValue;
   
   UFLCheckValidFormats(theForm, &invalidItems, &invalidItemsSize);
   if (invalidItemsSize == 0) 
   { 
       printf("All items in the form have correctly formatted values. \n"); 
   } 
   else 
   { 
     	printf("One or more of the items in the form have incorrectly formated values.\n");
     	for (i=0; i<invalidItemsSize; i++)
     	{ 
          UFLGetReferenceEx(invalidItems [i], NULL, NULL, NULL, OK, &theReference;);
          UFLGetLiteralByRefEx(invalidItems [i], NULL, "value", 0, NULL, NULL, &theValue;);
          printf("The item %s has an invalid value: %s\n", theReference, theValue);
          cp_free(theReference);
          cp_free(theValue);
     	}
     	pe_free(invalidItems);
   	}
   	return(OK);
}


Parent topic:
FormNodeP functions