views:

35

answers:

2

Hello.

I am trying to make the browser's password manager remember the input from the ajax form generated with gwt.

My idea is to use a hidden standard static html form on the page, and let the browser use that one. However, now I have to make the form submit the data upon clicking my custom gwt login button.

I can get the form element using the getElementById() or similar methods, but can I somehow submit that form so the browser asks to save the user data?

+1  A: 

jQuery can:

$("#formID").submit()

Upd. Raw JavaScript:

document.forms["formID"].submit();
Riateche
Append `$wnd.` to the beginning of that last line, call it from a [JSNI](http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html) method and it has a chance of working ;) I remember some threads on GWT's Google Group about combining browser's password managers and GWT - it's probably worth a look/search. As usual, IE was giving some trouble ;)
Igor Klimer
Thx. It worked that way, although I found the nicer looking solution without the need for native method:FormPanel.wrap(DOM.getElementById("hiddenLoginForm")).submit();
igorbel
+1  A: 

I think FormPanel is what you are looking for.

pathed
The problem with the FormPanel is that it also needs to be inside my gwt module, and therefore isn't visible to the browser upon the initial page load, and cannot be filled. So, I am using a standard form that is there before the gwt part of the page is generated. I can later easily mine that info and put it in my actual gwt form.
igorbel
@igorbel: Have you tried `FormPanel.wrap(Element element)`? From the javadoc: "Creates a FormPanel that wraps an existing <form> element. This element must already be attached to the document."
Chris Lercher
Yes.I ultimately used that solution to avoid a native method, although the end effect is the same. Thx for the input
igorbel