Autofill form fields

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Autofill form fields

zaucker
Hi,

is it possible to have Qooxdoo TextFields filled automatically by the
browser? Like on a login screen the username and password field?

I am using a qx.ui.window.Window() with a qx.ui.form.TextFields() and a
qx.ui.form.PasswordField(), but they are not filled when the application is
started.

Thanks,
Fritz

--
Oetiker+Partner AG              tel: +41 62 775 9903 (direct)
Fritz Zaucker                        +41 62 775 9900 (switch board)
Aarweg 15                            +41 79 675 0630 (mobile)
CH-4600 Olten                   fax: +41 62 775 9905
Schweiz                         web: www.oetiker.ch

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Autofill form fields

Daniel Wagner
Administrator
Hi Fritz,

you just have to give your field a "name" (or alternatively "id")
attribute so the browser knows how to store the value:

input.getContentElement().setAttribute("name", "username");


Regards,
Daniel

On 10.12.2014 23:32, Fritz Zaucker wrote:

> Hi,
>
> is it possible to have Qooxdoo TextFields filled automatically by the
> browser? Like on a login screen the username and password field?
>
> I am using a qx.ui.window.Window() with a qx.ui.form.TextFields() and a
> qx.ui.form.PasswordField(), but they are not filled when the application is
> started.
>
> Thanks,
> Fritz
>

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Autofill form fields

fritz
Hi Daniel,

thanks for the reply. Thie seems not enough, though. Do the fields have to
be inside a HTML <form></form>? I just placed them in a qx.ui.window.Window with a
qx.ui.layout.Grid layout at the moment. Or anything else I have to do?

I am submitting the username/password with  qx.io.remote.Rpc.callAsync().

Ideally the username/password would be filled in by the browser when the
login window appears ...

Cheers,
Fritz

On Thu, 11 Dec 2014, Daniel Wagner wrote:

> you just have to give your field a "name" (or alternatively "id")
> attribute so the browser knows how to store the value:
>
> input.getContentElement().setAttribute("name", "username");
>
> Regards,
> Daniel
>
> On 10.12.2014 23:32, Fritz Zaucker wrote:
>> Hi,
>>
>> is it possible to have Qooxdoo TextFields filled automatically by the
>> browser? Like on a login screen the username and password field?
>>
>> I am using a qx.ui.window.Window() with a qx.ui.form.TextFields() and a
>> qx.ui.form.PasswordField(), but they are not filled when the application is
>> started.
>>
>> Thanks,
>> Fritz
>>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>

--
Oetiker+Partner AG              tel: +41 62 775 9903 (direct)
Fritz Zaucker                        +41 62 775 9900 (switch board)
Aarweg 15                            +41 79 675 0630 (mobile)
CH-4600 Olten                   fax: +41 62 775 9905
Schweiz                         web: www.oetiker.ch

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Autofill form fields

Daniel Wagner
Administrator
Hi Fritz,

that's strange, it works for me (in Chrome and Firefox) with just this code:

      var input = new qx.ui.form.TextField();
      input.getContentElement().setAttribute("name", "username");
      this.getRoot().add(input);

A form tag should not be necessary, but you might try also setting the
"autocomplete" attribute to "on", although that should be the default.


Regards,
Daniel

On 11.12.2014 22:54, Fritz Zaucker wrote:

> Hi Daniel,
>
> thanks for the reply. Thie seems not enough, though. Do the fields have to
> be inside a HTML <form></form>? I just placed them in a qx.ui.window.Window with a
> qx.ui.layout.Grid layout at the moment. Or anything else I have to do?
>
> I am submitting the username/password with  qx.io.remote.Rpc.callAsync().
>
> Ideally the username/password would be filled in by the browser when the
> login window appears ...
>
> Cheers,
> Fritz
>
> On Thu, 11 Dec 2014, Daniel Wagner wrote:
>
>> you just have to give your field a "name" (or alternatively "id")
>> attribute so the browser knows how to store the value:
>>
>> input.getContentElement().setAttribute("name", "username");
>>
>> Regards,
>> Daniel
>>
>> On 10.12.2014 23:32, Fritz Zaucker wrote:
>>> Hi,
>>>
>>> is it possible to have Qooxdoo TextFields filled automatically by the
>>> browser? Like on a login screen the username and password field?
>>>
>>> I am using a qx.ui.window.Window() with a qx.ui.form.TextFields() and a
>>> qx.ui.form.PasswordField(), but they are not filled when the application is
>>> started.
>>>
>>> Thanks,
>>> Fritz
>>>
>>
>> ------------------------------------------------------------------------------
>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
>> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
>> with Interactivity, Sharing, Native Excel Exports, App Integration & more
>> Get technology previously reserved for billion-dollar corporations, FREE
>> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>>
>

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Autofill form fields

Tom Saddul
In reply to this post by fritz
One way is to setup setters and getters for each field utilizing closures.  This is what I prefer because it can work with as many tables without creating bloat code.

Another way is to create a method for setting fields i.e. setData() and another a method to retrieve the field values i.e. getData().  This is required in almost every table.  For simple data entry like for inputting UserName and Password, I prefer to use this technique.
Reply | Threaded
Open this post in threaded view
|

Re: Autofill form fields

fritz
In reply to this post by Daniel Wagner
Hi Daniel,

in partly works for me. With the code you suggested I get a list of
suggestions when clicking into the TextField(). However, the list of
suggestions has only strings stored from other websites and is not updated
on rpcAsync() backend calls. The fields are also not automatically filled on
loading the page (or the login screen appearance). I am not really sure what
the problem is.

Anyway, as it gives me much more control, I decided to implement the storing
and loading of the login screen fields myself using HTML5 localStorage:

   supports_html5_storage = function() {
       try { return 'localStorage' in window && window['localStorage'] !== null; }
       catch (e) { return false;
   };

   var username = new qx.ui.form.TextField();
   this.addListener('appear', function() {
       if (supports_html5_storage() && localStorage.getItem('myUsername') != null) {
           username.setValue(localStorage.getItem('myUsername'));
       }
   }, this;

   this.loginHandler : function(ret, exc) {
       if (exc) {
           alert('Login error');
       }
       else {
           if (supports_html5_storage()) {
               localStorage.setItem('myUsername', username.getValue());
           }
       }
   };

   Doing the same for the password field and adding a check box "Remember me"
   gives all the functionality needed.

Cheers,
Fritz

On Fri, 12 Dec 2014, Daniel Wagner wrote:

> Hi Fritz,
>
> that's strange, it works for me (in Chrome and Firefox) with just this code:
>
>      var input = new qx.ui.form.TextField();
>      input.getContentElement().setAttribute("name", "username");
>      this.getRoot().add(input);
>
> A form tag should not be necessary, but you might try also setting the
> "autocomplete" attribute to "on", although that should be the default.
>
>
> Regards,
> Daniel
>
> On 11.12.2014 22:54, Fritz Zaucker wrote:
>> Hi Daniel,
>>
>> thanks for the reply. Thie seems not enough, though. Do the fields have to
>> be inside a HTML <form></form>? I just placed them in a qx.ui.window.Window with a
>> qx.ui.layout.Grid layout at the moment. Or anything else I have to do?
>>
>> I am submitting the username/password with  qx.io.remote.Rpc.callAsync().
>>
>> Ideally the username/password would be filled in by the browser when the
>> login window appears ...
>>
>> Cheers,
>> Fritz
>>
>> On Thu, 11 Dec 2014, Daniel Wagner wrote:
>>
>>> you just have to give your field a "name" (or alternatively "id")
>>> attribute so the browser knows how to store the value:
>>>
>>> input.getContentElement().setAttribute("name", "username");
>>>
>>> Regards,
>>> Daniel
>>>
>>> On 10.12.2014 23:32, Fritz Zaucker wrote:
>>>> Hi,
>>>>
>>>> is it possible to have Qooxdoo TextFields filled automatically by the
>>>> browser? Like on a login screen the username and password field?
>>>>
>>>> I am using a qx.ui.window.Window() with a qx.ui.form.TextFields() and a
>>>> qx.ui.form.PasswordField(), but they are not filled when the application is
>>>> started.
>>>>
>>>> Thanks,
>>>> Fritz

--
Oetiker+Partner AG              tel: +41 62 775 9903 (direct)
Fritz Zaucker                        +41 62 775 9900 (switch board)
Aarweg 15                            +41 79 675 0630 (mobile)
CH-4600 Olten                   fax: +41 62 775 9905
Schweiz                         web: www.oetiker.ch

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Autofill form fields

fritz
And as Tobi pointed out to me:

I should use qx.bom.storage.Web instead ...

Cheers,
Fritz

On Mon, 15 Dec 2014, Fritz Zaucker wrote:

> Hi Daniel,
>
> in partly works for me. With the code you suggested I get a list of
> suggestions when clicking into the TextField(). However, the list of
> suggestions has only strings stored from other websites and is not updated
> on rpcAsync() backend calls. The fields are also not automatically filled on
> loading the page (or the login screen appearance). I am not really sure what
> the problem is.
>
> Anyway, as it gives me much more control, I decided to implement the storing
> and loading of the login screen fields myself using HTML5 localStorage:
>
>  supports_html5_storage = function() {
>      try { return 'localStorage' in window && window['localStorage'] !==
> null; }
>      catch (e) { return false;
>  };
>
>  var username = new qx.ui.form.TextField();
>  this.addListener('appear', function() {
>      if (supports_html5_storage() && localStorage.getItem('myUsername') !=
> null) {
>          username.setValue(localStorage.getItem('myUsername'));
>      }
>  }, this;
>
>  this.loginHandler : function(ret, exc) {
>      if (exc) {
>          alert('Login error');
>      }
>      else {
>          if (supports_html5_storage()) {
>              localStorage.setItem('myUsername', username.getValue());
>          }
>      }
>  };
>
>  Doing the same for the password field and adding a check box "Remember me"
>  gives all the functionality needed.
>
> Cheers,
> Fritz
>
> On Fri, 12 Dec 2014, Daniel Wagner wrote:
>
>> Hi Fritz,
>>
>> that's strange, it works for me (in Chrome and Firefox) with just this
>> code:
>>
>>      var input = new qx.ui.form.TextField();
>>      input.getContentElement().setAttribute("name", "username");
>>      this.getRoot().add(input);
>>
>> A form tag should not be necessary, but you might try also setting the
>> "autocomplete" attribute to "on", although that should be the default.
>>
>>
>> Regards,
>> Daniel
>>
>> On 11.12.2014 22:54, Fritz Zaucker wrote:
>>> Hi Daniel,
>>>
>>> thanks for the reply. Thie seems not enough, though. Do the fields have to
>>> be inside a HTML <form></form>? I just placed them in a
>>> qx.ui.window.Window with a
>>> qx.ui.layout.Grid layout at the moment. Or anything else I have to do?
>>>
>>> I am submitting the username/password with  qx.io.remote.Rpc.callAsync().
>>>
>>> Ideally the username/password would be filled in by the browser when the
>>> login window appears ...
>>>
>>> Cheers,
>>> Fritz
>>>
>>> On Thu, 11 Dec 2014, Daniel Wagner wrote:
>>>
>>>> you just have to give your field a "name" (or alternatively "id")
>>>> attribute so the browser knows how to store the value:
>>>>
>>>> input.getContentElement().setAttribute("name", "username");
>>>>
>>>> Regards,
>>>> Daniel
>>>>
>>>> On 10.12.2014 23:32, Fritz Zaucker wrote:
>>>>> Hi,
>>>>>
>>>>> is it possible to have Qooxdoo TextFields filled automatically by the
>>>>> browser? Like on a login screen the username and password field?
>>>>>
>>>>> I am using a qx.ui.window.Window() with a qx.ui.form.TextFields() and a
>>>>> qx.ui.form.PasswordField(), but they are not filled when the application
>>>>> is
>>>>> started.
>>>>>
>>>>> Thanks,
>>>>> Fritz
>
>

--
Oetiker+Partner AG              tel: +41 62 775 9903 (direct)
Fritz Zaucker                        +41 62 775 9900 (switch board)
Aarweg 15                            +41 79 675 0630 (mobile)
CH-4600 Olten                   fax: +41 62 775 9905
Schweiz                         web: www.oetiker.ch

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel