added js validation for mandatory fields