Safely set form text values to avoid problems with undefined and null