Javascript recognizes form submission