attach distance js to a form