and js validation function