TypeInvite and password fields.

15 views
Skip to first unread message

ger.be...@gmail.com

unread,
Jun 5, 2013, 8:21:33 AM6/5/13
to inp...@googlegroups.com
Hi,

I don't like to use labels with my fields. I prefere to use a system like "typeInvite".
Unfortunately with Inputex, when i try to combine password fields and typeInvite, I get a "hid typeInvite".
It's not my wish, I would like a "password" word as type invite not a "••••••••".

It is a bug or can I do somethings ?

Thank !
Benjamin

Pierre Colle

unread,
Jun 6, 2013, 5:18:57 AM6/6/13
to inp...@googlegroups.com
I already had this issue before

You should try to override the updateTypeInvite function (originaly in StringField.js) in Password Field file, and add it 3 lines that change this.el's type atttribute :

updateTypeInvite: function() {

// field not focused
      if (!Y.one(this.divEl).hasClass( "inputEx-focused")) {

         // show type invite if field is empty
         if(this.isEmpty()) {
Y.one(this.divEl).addClass( "inputEx-typeInvite");
               this.el.setAttribute("type","");
this.el.value = this.options.typeInvite;

// important for setValue to work with typeInvite
         } else {
this.el.setAttribute("type","password");
            Y.one(this.divEl).removeClass("inputEx-typeInvite");
         }

      // field focused : remove type invite
      } else {
if(Y.one(this.divEl).hasClass("inputEx-typeInvite")) {
// remove text
this.el.value = "";

// remove the "empty" state and class
this.previousState = null;
               this.el.setAttribute("type","password");
Y.one(this.divEl).removeClass("inputEx-typeInvite");
         }
      }
},


--
You received this message because you are subscribed to the Google Groups "inputex" group.
To unsubscribe from this group and stop receiving emails from it, send an email to inputex+u...@googlegroups.com.
To post to this group, send email to inp...@googlegroups.com.
Visit this group at http://groups.google.com/group/inputex?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

ger.be...@gmail.com

unread,
Jun 6, 2013, 11:29:42 AM6/6/13
to inp...@googlegroups.com
Ok, so this is effectively a bug...

Anyway, your override work perfectly. Thanks !

ger.be...@gmail.com

unread,
Jun 6, 2013, 12:59:40 PM6/6/13
to inp...@googlegroups.com
Mhhh, not perfectly, it add "password" type to ALL my fields T_T

This update work better (Just wrap your modifications in "if" conditions, all my password fields must now have a class "password")

Y.inputEx.StringField.prototype.updateTypeInvite = function() {


     // field not focused
     if (!Y.one(this.divEl).hasClass("inputEx-focused")) {

        // show type invite if field is empty
        if (this.isEmpty()) {
           Y.one(this.divEl).addClass("inputEx-typeInvite");
           if (this.el.className.indexOf("password") > -1) {

              this.el.setAttribute("type", "");
           }
           this.el.value = this.options.typeInvite;

           // important for setValue to work with typeInvite
           } else {
           if (this.el.className.indexOf("password") > -1) {

              this.el.setAttribute("type", "password");
            }
        Y.one(this.divEl).removeClass("inputEx-typeInvite");
        }

     // field focused : remove type invite
     } else {
        if (Y.one(this.divEl).hasClass("inputEx-typeInvite")) {

           // remove text
          this.el.value = "";
         
          // remove the "empty" state and class
          this.previousState = null;
          if (this.el.className.indexOf("password") > -1) {

ger.be...@gmail.com

unread,
Jun 6, 2013, 1:08:01 PM6/6/13
to inp...@googlegroups.com
And last improvement, you can simplify your life if you use "this.fieldContainer" instead of "this.el" in my if statements.
Reply all
Reply to author
Forward
0 new messages