Why do this in ,preprocess page instead of attaching the JS to the form?