Hey Varol,

thanks for your input. It seems like this is the correct way. Here's my
solution (Works in IE, FF, Safari, Opera but NOT Chrome)

Using your derived class was the first step. Second is to derive
qx.ui.form.AbstractField:

qx.Class.define("edl.online.widget.home.LoginFormButton",{
        extend : qx.ui.form.AbstractField,
        
        construct : function ( attributes )  { 
                this._attributes = attributes || {}; 
                this.base ( arguments ); 
        }, 

        members : {
                _createInputElement : function() {
                        return new 
qx.html.Input("submit",null,this._attributes);
                }
        }
});

This has to be done, because browsers need a <input type="submit"> to
trigger their save mechanism. My approach is kept simple ... I don't have a
qx.Atom based Element with icons and stuff.

You also need the <input> fields with propper name attributes, so I do s/th
like this


var nameInput = new qx.ui.form.TextField();
nameInput.addListener("appear",function(e){
        var el = nameInput.getContentElement().getDomElement();
        el.id = "username";
        el.name = "username";
});

var passInput = new qx.ui.form.PasswordField();
passInput.addListener("appear",function(e){
        var el = passInput.getContentElement().getDomElement();
        el.id = "password";
        el.name = "password";
});

var loginButton = new edl.online.widget.home.LoginFormButton({
        value : this.tr("login")
});
leftBox.add(loginButton);

So the main work is done. There is just one little thing, which might be
confusing if you try to access the input.value via qx methods
(nameInput.getValue()) It's because the browser autofill method don't fires
a "changeValue" Event and so a getValue() returns null. Therfore I access
the DOM-Elements and get the native value instead:

var name = nameInput.getContentElement().getDomElement().value;
var pass = passInput.getContentElement().getDomElement().value;
this._login(name,pass);


Last but not least, there are two ways, to prevent the form submitting. You
could add a attribute {submit: "return false;"} or add an iFrame as a target
(like I did). The solution with the iFrame should work in Chrome, because
Chrome ask you for saving passwords AFTER a submit. But it didn't work for
me. Maybe s/o else could figure out, how to convince Chrome.

So this is what I did. I created a new empty file "blank.html" beside
index.html.

var pseudoTarget = new qx.ui.container.Composite(new qx.ui.layout.VBox(5))
var leftBox = new edl.online.widget.home.LoginForm(new
qx.ui.layout.VBox(5),{ 
        id : "loginForm",
        name : "loginForm", 
        method: "POST", 
        autocomplete : "on",
        target : "pseudoTarget"
});
var iFrame = new qx.html.Iframe("blank.html",null,{
        name : "pseudoTarget"
});
pseudoTarget.getContentElement().add(iFrame);
leftBox.add(pseudoTarget);


This works for me, I hope it would help s/o else too. Questions are welcome.

greetings,
schlagges



--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/Let-the-browser-save-the-passwords-tp7584742p7584750.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to