Getting Data

There are two main ways to get the data for a particular field. These are as follows:

Making individual calls for each field on the Ispec

For example, for the MENU Ispec, the fields are: top_line, actmth, test, foo, da1, and at_sign. Note the Java requirement that a dash(-) is not allowed and is converted to an underscore(_) character. The text fields on the HTML form are named f1 to f6.

The code to get the data and copy it to the HTML objects is:

f1.value = ispec.getFieldValue("top_line")
f2.value = ispec.getFieldValue("actmth")
f3.value = ispec.getFieldValue("test")
f4.value = ispec.getFieldValue("foo")
f5.value = ispec.getFieldValue("da1")
f6.value = ispec.getFieldValue("at_sign")

To use this method, you must have requested Generate Getters & Setters in the Generator. The code shown above would need to be in the Ispec HTML file for each Ispec, and would be specific for each Ispec.

Accessing every object on a form as an array

A JavaScript feature allows you to iterate through the objects on a form.

If you name each input object as the equivalent Ispec field name, you can test each object name to determine if it is a field on the Ispec. If it is, you can get the data for the field. Refer to copyIspecToForm() function in dwtest.html for an example.

Note the page_display.receiveHook() function call in thecopyFieldtoForm() function. This calls a hook function in the Ispec HTML page. If you wish to handle a particular field on that Ispec in a specific way, you can insert code into the hook function and return true. The remaining fields that require no specific handling all returnfalse. Refer to dwtest_T0010.html for an example.

This method, while harder to code, does reduce your implementation effort as you do not have to write code to get and set data for every Ispec, also creating the HTML forms.