Community articleSetting a Value in a Form
Added by IBM contributorIBM on May 6, 2011
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Once a form is loaded into memory, a developer can set the values associated with any of the item or option nodes located in the form by calling setLiteralByRefEx.
  1. Define the method setBirthDay and an integer variable to reference the user's day of birth.
  2.     private static void setBirthDay(int birDay) throws Exception
           Integer day = new Integer(birDay);

  3. Call the method setLiteralByRefEx to assign the user's day of birth to the form's hidden day field.
  4.       theForm.setLiteralByRefEx(null, "PAGE1.HIDDENDAY.value", 0, 
             null, null, day.toString());

  5. Define the remaining methods to set the user's birth month and year in the form's hidden fields. These methods will be exactly the same as setBirthDay except for the parameters passed to getLiteralByRefEx.
    • setBirthMonth( ) – sets the value PAGE1.HIDDENMONTH.value in theForm.
    • setBirthYear( ) – sets the value PAGE1.HIDDENYEAR.value from theForm.

Parent topic: Developing an application in Java