CORE-1804 Refactor javascript in poll/_validate.gsp into separate js file