JSDO properties, methods, and events reference : getFormFields( ) method
  

getFormFields( ) method

Reads the schema of the referenced table and returns a string containing the HTML text of field definitions created by processing a UIHelper form field template against fields that you specify.
Return type: string
Applies to: progress.ui.UIHelper class, table reference property (UIHelper class)

Syntax

uihelper-ref.getFormFields ( [ array ] )
uihelper-ref.table-ref.getFormFields ( [ array ] )
uihelper-ref
A reference to a UIHelper instance. You can call the method on uihelper-ref if the JSDO associated with the instance has only a single table reference.
table-ref
A table reference on the JSDO associated with the UIHelper instance.
array
An array of string specifying the names of a subset of fields from the table schema for which to return HTML field definitions. If this parameter is omitted, the HTML definitions for all fields in the table are returned.
If you do not specify the fields for which to return HTML, the method returns HTML field definitions for all the fields in the table, including a field definition for the JSDO-reserved internal record ID.
If you do specify fields, only the HTML definitions for the specified fields are returned. If you also want to return the HTML field definition for the internal record ID, you must specify _id as a field to return. (See the example.)
The UIHelper class provides a default form field template for a jQuery Mobile environment. The following code fragment shows the default template values:
<div data-role="fieldcontain">
    <label for="{__name__}">{__label__}</label>
    <input id="{__name__}" name="{__name__}" placeholder="" value="" type="text" />
</div>
As shown above, the default template uses the following substitution parameters:
*{__name__} — The field name as defined in the schema
*{__label__} — The field's title property as defined in the schema
You can define a template to be used in place of the default by calling setFieldTemplate( ).

Example

The following code fragment invokes getFormFields( ) to generate HTML definitions for three fields of the the associated JSDO eCustomer table, including a field for the JSDO-reserved record ID:
var dataSet = new progress.data.JSDO( 'dsCustomerOrder' );
var htmlText = "";

uihelper = new progress.ui.UIHelper({ jsdo: dataSet });
htmlText = uiHelper.eCustomer.getFormFields([ '_id', 'CustNum' , 'Name' ]);
/* write out htmlText to the current document */
Unspecified code typically writes out the HTML from htmlText to a field container in the current document.

See also:

getFormRecord( ) method, setFieldTemplate( ) method