The-M-Project icon indicating copy to clipboard operation
The-M-Project copied to clipboard

Password TextFieldView is rendered as regular text after FormView.clearForm()

Open aliozgur opened this issue 12 years ago • 3 comments

TextFieldView with M.INPUT_PASSWORD type is rendered as regular text field after FormView.clearForm() is called if initialText is not set on the TextFieldView.

aliozgur avatar Dec 24 '12 09:12 aliozgur

I have version 1.3 and the problem seems to be in setValue function of text_field.js. When I specify ' ' as the initialText the problem is resolved.

aliozgur avatar Dec 24 '12 09:12 aliozgur

thx for the hint. we will look into it.

dominiklaubach avatar Dec 27 '12 10:12 dominiklaubach

This seems to be a copy paste bug. Please see my comment below (text_field.js)

setValue: function(value, delegateUpdate, preventValueComputing) {
      this.value = value;

  // Handle the classOnInit for initial text
  if(value != this.initialText) {
    if(this.cssClassOnInit) {
      this.removeCssClass(this.cssClassOnInit);
    }
    if(this.inputType == M.INPUT_PASSWORD) {
      // Set the field type to password
      $('#' + this.id).prop('type','password');
    }
  }
  else {
          if(this.cssClassOnInit) {
              this.addCssClass(this.cssClassOnInit);
          }

    if(this.inputType == M.INPUT_PASSWORD) {
      // Set the field type to text
      // Ali özgür : COPY/PASTE BUG :) 
      // $('#' + this.id).prop('type','text');

      $('#' + this.id).prop('type','password');
    }
  }

      this.renderUpdate(preventValueComputing);

      if(delegateUpdate) {
          this.delegateValueUpdate();
      }
  },

aliozgur avatar Dec 28 '12 19:12 aliozgur