Support for red input boxes on error

Added in setAttribute to set the color of the input box to red if an
error occurred and also added an else statement to reset the color when
a user enters input in the field.