adding javascript validations for preference input