Added JavaScript validation