public void setAnswer ( String variable , boolean value ) { FormField field = getField ( variable ) ; if ( field == null ) { throw new IllegalArgumentException ( "Field not found for the specified variable name." ) ; } if ( field . getType ( ) != FormField . Type . bool ) { throw new IllegalArgumentException ( "This field is not of type boolean." ) ; } setAnswer ( field , Boolean . toString ( value ) ) ; }
Sets a new boolean value to a given form s field . The field whose variable matches the requested variable will be completed with the specified value . If no field could be found for the specified variable then an exception will be raised .