When specifying settings for a field, you can provide values for the Reload Function and Reload Program settings. The Reload Program setting specifies a JSP that contains the function defined by the Reload Function setting. The logic in the function determines the value to load into the field. See these settings in Settings for Fields in Web Form Objects for more details. As an example, you could configure two related fields where the value for one field determines the value for another field, such as a City and a Country field. City would be the parent field and Country would be the child field in this example. If the City was changed to Paris, the Country should be changed to France whereas if the City was changed to New York, the country should be changed to USA. You can use the Reload Program and Reload Function settings on fields with the OnChange Handler or OnFocus Handler settings. The OnChange Handler would be configured on the parent field so that when its value was changed, it would call the Reload Function on the child field to update the child field value. Another use for these settings is when a parent field has a child field with range values. The OnChange Handler can be configured on the parent field to clear out the existing value in the child field; the child field would be configured with an OnFocus Handler to trigger its Reload Program to update the child range values. This code shows a sample reload function: public static HashMap ReloadAPI (Context context, String[] args) throws Exception{ HashMap resultMap = new HashMap(); StringList fieldRangeValues = new StringList(); StringList fieldDisplayRangeValues = new StringList(); //Reload the range Values fieldRangeValues.addElement("UK"); fieldRangeValues.addElement("INDIA"); fieldDisplayRangeValue.addElement("UK"); fieldDisplayRangeValue.addElement("INDIA"); resultMap.put("RangeValues", fieldRangeValues ); resultMap.put("RangeDisplayValue", fieldDisplayRangeValues); //Reload the Selected Value resultMap.put("SelectedValues", "USA" ); resultMap.put("SelectedDisplayValue", "USA" ); return resultMap; } |