Handle undefined text area values

Check to see if a text area's `val` is defined before trying to call
`replace()` on it.
Merge pull request #7572 from mr-vinn/application-js-fix

Handle undefined text area values