Added form error and JS functionality