.
 News & Views
  The online information source for iSeries and mrc-Productivity Series users
.  March 2002  
Volume 2, Issue 3  
.
. . . . . . . . .

EXCLUSIVE!!
mrc introduces new features
Web-based applications offer a multitude of options

Standard green-screen applications are limited to displaying an input field as simply an input-capable field. One of the great features of Web-based applications is the multitude of options for displaying updateable fields to end-users. HTML can define an input field as a text box, text-area box, drop-down list, radio button, and checkbox. These other interface types can simplify the interface, make valid choices clearer to the end-user, and reduce or eliminate training costs. The mrc-Productivity Series gives the application builder the power to specify which of these input field types is best suited for updating a data field.
The Default Text Box
The default field type is the text box. It is analogous to the input-capable field of a green-screen application. Specify that a field is "U" for Updateable" and you will create an input field of this type. This input type is fine for many types of fields including character and numeric input fields.
The Text-Area Box
If the updateable field is large, then the application designer may wish to display the field as a multiple-line, comment-style field with wrapping text. This field type is called a text-area input in HTML vernacular. If your database field is larger than 50 characters, then the mrc-Productivity Series automatically creates that field as this display type. If you have a field smaller than that, but wish to display it as a text-area input, it is a simple matter to paint that change into the HTML skeleton.
The Drop-down List and Radio Button
If the updateable field has finite valid values, the application builder may wish to display those valid values to the end-user in a drop-down list or as a radio button. To accomplish this within the mrc-Productivity Series, just use the pre-format screen to specify the "Validity Check" as "LS" (drop-down list) or "RD" (radio button) and enter the valid values in the "Validity Value".
The only difference between these two input types is that the drop-down list displays the valid choices only when selected while the radio button lays out all valid options on the screen. The drop-down list, therefore, might be more appropriate when saving screen real estate is important. The radio button is better suited when you want to be certain that the end-user can clearly see all of her choices at once without scrolling.
The Checkbox
The checkbox is a special case of valid option inputs. It allows only one value to be sent to the file field, besides *BLANK (for a character field) or zero (for a numeric field.) Its use is appropriate for fields that are considered Boolean, such as true/false, on/off, one/zero, etc. But please note: it cannot actually send "Y" or "N". It can only handle either ("Y" or " ") or (" " or "N"). To create an input as a checkbox, specify the "Validity Check" as "CK" and enter the one valid value in the "Validity Value".
Displaying the Text instead of the Code
For these special input fields, it may be necessary to display text instead of the code values themselves that will go into the database field. If so, then simple changes to the generated HTML skeleton will do the trick. Examples illustrate the techniques below.

Here is the JavaScript code example for a drop-down list or radio button:

Before painting: conditionValue[index] = "1 2 3 4" The default will display a drop-down list with "1, 2, 3, 4" in the list and send those exact values to the database field.

After painting: conditionValue[index] = "1=Text1 2=Text2 3=Text3 4=Text4" This change will display a drop-down list with "Text1, Text2, Text3, Text4" in the list and send "1, 2, 3, 4" to the database field.

Here is a Checkbox example:

Before painting: conditionValue[index] = "Y" This will yield a checkbox that sends "Y" when checked and *BLANK when not checked and display the text "undefined" next to the input checkbox. Change "Y" to "Y " to eliminate the "undefined" text.

After painting: conditionValue[index] = "Y Text" This will work as before and also display "Text" next to the input checkbox.

The default option delimiter is " " and the value/text separator is "=". If you want the text to include spaces, then you need to make another small change and define the separator as in the example below.

After painting: conditionValue[index] = "1=Text1 is 1;2=Text2 is 2;3=Text3 is 3;4=Text4 is 4"

Also, find this code that creates a radio button input: <script>setRadio('XXX','show','K006',"@K006",parseInt('006',10)-1,1," ","=");</script>

The last two parameters tell the JavaScript function to use a space (" ") to delimit choices and an equals sign ("=") to separate the value from the text. Modify as needed for each field that calls the setList, setRadio, and setCheckbox functions. The last example uses the semicolon (";") to separate the options, so the JavaScript should be modified to look like this: <script>setRadio('XXX','show','K006',"@K006",parseInt('006',10)-1,1,";","=");</script>

Live on the Web
See an application using various input field types live on the Web: http://www.crazybikes.com/employees/I00220GC.mrc. Select an order to update. The update application employs the standard text input, as well as the drop-down list, radio button, and checkbox.

Take Our Poll

What language do you most often use to develop applications?

RPGIV
Java
Visual Basic
C
Other

View Results
View Poll Archive

.
.
.
.
. Quick Links...

Visit mrc's Web site

See a live demo

Get more information

View Latest Newsletter

Last Month's Newsletter

.
.
.
.
. Contact mrc...

U.S. Offices
mrc@mrc-productivity.com

voice: 630-916-0662

www.mrc-productivity.com



U.K. Offices
michaels, ross & cole (UK) ltd

voice (UK): +44 (0)20 8282 1600

mail@mrcuk.com

.
 mrc publishes this newsletter on a monthly basis. Subscription is free of charge. Please send any questions or comments about this newsletter to news@mrc-productivity.com. This newsletter is edited by Heather Gately.

Visit our subscription center to update your subscription or unsubscribe.
View our privacy promise.

.