refactor grid search form js