Added sanitization function to form class to handle strings and arrays.

Closes #295