Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 30 Next »

Overview

This is a very simple text entry field used for input/output.

The 'value' property is where you set a initialized value for the textbox. Whatever you place inside the 'value' will be present when the textbox is displayed.

Validation (Rich UI Only)

(Input link to validation and error messages page under Input Widgets section)

Field Binding Dialog (Rich UI Only)

(Input link to Field Binding page under Widget section)

Field Settings

Input Type (Rich UI Only)

These properties are used to specify an input type for the textbox. These are primarily used for mobile applications, but some of these input types are supported by HTML5 capable browsers. If this field is not set a standard textbox element will be used by default.

Date - The Date input type is used to create a date field for the textbox. When supported it allows your user to select a date which is automatically formatted for the field and returns the date as a value.

Datetime - Similar to the Date input type this allows the user to select a date and time (with time zone).

Email - This input type would be used for a field you are expecting an email address to be entered. For mobile browsers this field allows your device to recognize the email type and change the on-screen keyboard to match (giving @ and .com options depending on the device).

Time - The time input type gives the user a field to accept a time entry format. This input type does not give a time zone like the datetime type.

Month - The month input type functions like the Date type, with the exception there is no day indicated in the format. It allows the user to only select a month and year.

Number - The number type should be used when a field is set to contain a numeric value you want to impose a restriction on.

Tel - This input type would be used for a field needing a telephone number format.

URL - The url type is for input fields containing a URL address. For mobile browsers this field allows your device to recognize the email type and change the on-screen keyboard to match (giving .com options depending on the device).

Auto-Complete Choices

Auto-complete allows your textbox field to automatically suggest choices based on text entered into the textbox.

The auto-complete choices/values can be populated multiple ways:

Comma separated list - A simple list of values separated by just a comma (i.e. Apple, Orange, Banana).

Database file - See Database-Driven Auto-Complete section below.

JSON array format - Using JSON array format, meaning the choices/values are enclosed in a bracket with quotations and then comma separated (i.e. ["ElementOne", "ElementTwo"] ) within the choices and choice values fields also allows you to populate the auto-complete, these fields can also be bound to an RPG field (Rich UI only).

Web service - You can pass JSON through a web service such as a PHP program to complete the choices and choice value fields (see choices URL example below).

Database-Driven Auto-Complete

This section allows choices/values to be retrieved from a database file. In order to use this, simply enter the name of the database file, the name of the choice option field(s) you would like to search by, and the name of the choice value field you wish to return the value of to your application.

 

Selecting Multiple Columns

If there are multiple fields specified in the choice options field this will allow you to return multiple values in the auto-complete search. However, only the first value in the field will be used to search, any other selected fields are for display only.

SQL Expressions

You can also use SQL expressions to return information in addition to just selecting database fields from the file. So in the example, using the expression TRIM(CNAME) || ', ' || CATID allows us to return a concatenated search value with formatting for our search, but the returned value to the application is unchanged.

Max Choices
The max choices property allows you to set the number of choices you will see from your database-driven selection. There is no limit to the number of choices you can show, however if there is no limit set the default is 10.

Contains Match

This property when set to true looks for records that contain your search text. When set to false the query looks for your at the start of the records to match your search text. The default for this is set to false.

Dynamic Auto-Complete

Choices URL

The choices URL property allows you to use a web service to return your choice options and values by passing them using JSON formatting. A PHP script would be one example of a service used to pass the values to your application. When using the choices url property, all database-driven auto-complete properties are ignored.

Good JSON Syntax Example

These are values returned from an auto-complete textbox in a good example of JSON formatting:

{
    "success": true,
    "response": {
        "colWidths": [
            41,
            7
        ],
        "results": [
            {
                "00001": "Alpineaire Food, 58",
                "CATID": "58"
            },
            {
                "00001": "Altimiters, 13",
                "CATID": "13"
            },
            {
                "00001": "Avalanche Gear, 82",
                "CATID": "82"
            }
        ]
    }
}

PHP Error Example

// Example of error reporting.
    $con = db2_connect(DB, USER, PASS, array("i5_naming" => DB2_I5_NAMING_ON));
    if (!$con) {
    
      $response = array(
      
        "success" => false,
        "errorId" => db2_conn_error(),
        "errorText" => db2_conn_errormsg()
      
      );
      
      print json_encode($response);
      return;
    
    }

Returned JSON Error Example

This is the information returned using JSON formatting to report an error with an auto-complete textbox. This was passed from the example above.

{
    "success": false,
    "errorId": "08001",
    "errorText": "Authorization failure on distributed database connection attempt. SQLCODE=-30082"
}

If you are unable to get any information to display on your choice URL script you can use the showErrors() API to try and debug the reason the auto-complete is unable to display results.
showErrors() API Documentation

Example of the showErrors() API displaying the JSON error example:

  • No labels