added some javascript validation