Only assign if val is not null

This was causing radio buttons to be set to null values for the data events. Sorry for the white space changes.