External onclick handler for checking inputs on submit.