Updated JavaScript to execute on 'Submit' not 'Click'