Hi Florin,

florin.g wrote:
When we do form.getFieldValue("afield") the return is an empty string "".
This appears to be convenient at times, yet is it not more appropriate to
have NULL returned when the value of the field is never set?


Yes sometimes one is preferred above the other. getFieldValue delegates to form.getValue() which returns the empty string even if the value is null. This is convenient when rendering the value of a Field, otherwise one will have to check for null throughout the code.

What you can do is use getValueObject which returns the Object representation of the field value and won't interfere if the value is truly null.

So you could instead do:

  form.getField("afield").getValueObject();

Hope this helps.

kind regards

bob

Reply via email to