update validate.js to work.

needed a return function name to get the JS to stop the PHP from
executing
moved return statement to bottom

this cleared up the warning message