Setting a Value in a Form

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.
        private static void setBirthDay(int birDay) throws Exception
        {
           Integer day = new Integer(birDay);
    
  2. Call the method setLiteralByRefEx to assign the user's day of birth to the form's hidden day field.
          theForm.setLiteralByRefEx(null, "PAGE1.HIDDENDAY.value", 0, 
             null, null, day.toString());
       }
    
  3. 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.