Skip to content
Advertisement

Google closure – Triggering form submit

I have a form with a closure ui button:

JavaScript

I made my button submit my form:

JavaScript

Now, I have the 2 followings issues:

  • The form is not submitted when I push “Enter” in one of the fields
  • The event goog.events.EventType.SUBMIT is not triggered on the form, so my eventual listeners wont be executed

How can I fix this?

Advertisement

Answer

The hack I found is to:

  • append an hidden button tag
  • trigger a click on the hidden button on the event ACTION


JavaScript


EDIT : As Safari and Chrome does not trigger events on hidden with “Display: none” elements, we must hide the button with other css rules

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement