add js validation to templates