Field.setValue

Sets a value for the form field. The object types that can be used for value vary according to the form field type as shown in the table below. In most cases, the mapping between object types and form field types is handled automatically. Date and time fields require special consideration, particularly when calculations are performed.

Throws an FormRuntimeException if the value is not appropriate for the field type.

Field TypeSupported Object Types
Boolean Boolean: any value
String: true values are "true", "Y", "Yes", "1", false values are "false", "N", "No", "0"
Number: 1 is true, 0 is false
Character String: any value
Boolean: true becomes "Y", false becomes "N"
Number: any value
Integer
Number
Currency
String: any numeric value
Number: any value
Date Date: both Java Date (java.util.Date) and Javascript Date objects can be used
String: must be in the format specified in parameter Ufs.dateFormat in file UFSSetup.properties
Number: represents the number of milliseconds since 1st January 1970
Datetime Date: both Java Date (java.util.Date) and Javascript Date objects can be used
String: Date followed by a space then Time.
Date must be in the format specified in parameter Ufs.dateFormat in file UFSSetup.properties
Time is in the format hh:mm:ss.ttt
Number: represents the number of milliseconds since 1st January 1970
Time Date: both Java Date (java.util.Date) and Javascript Date objects can be used
String: must be in the format hh:mm:ss.ttt
Number: represents the number of milliseconds since midnight
Object Any object type can be used. Note that these objects become part of the form state and must therefore implement the Java Serializable interface.

Further documentation.

Javascript examples:

 fields.CHAR_FIELD.value = "Test";
 fields.CHAR_FIELD.setValue("Test");
 fields.NUM_FIELD.value = 123.456;
 fields.BOOL_FIELD.value = true;
 fields.DATE_FIELD.value = new Date();
 

Parameters

java.lang.Object  value,