Validate datatype when writing to value attribute.