cvn / angular-shims-placeholder

Angular directive to emulate the placeholder attribute on text and password input fields for old browsers, such as IE9, IE8, and IE7. Also works on textareas and html5 input types.
MIT License
63 stars 26 forks source link

IE9 - page refresh changes placeholder text to the actual field value #10

Closed weshardee closed 10 years ago

RopoMen commented 10 years ago

I agree with this one. This also arises problem with angular form validations because it may set form as "invalid" from the beginning and it looks bad for the user. Example custom regex validation for the string. I haven't tested how acts when placeholder text is used.

IE9 and IE8 issues should be taken seriously because those browsers are only ones which actually are needing this whole thing :) (at least what I know, IE7 can be forget now days and don't know any mobile browser lacking placeholder support?)

cvn commented 10 years ago

The way I'm reading the title, it seems like if you have a field like <input value="val" placeholder="place"> Then the placeholder will show place on first load, but val after a page refresh? @weshardee @RopoMen Could either or both of you confirm this is the problem you're seeing?

I'm working on some other fixes that should make the plugin more reliable, and hopefully take care of inconsistencies like this, but I want to be sure I know what's being reported here.

RopoMen commented 10 years ago

Hi,

In my case I have half SPA page where I use AngularJS, so some parts are done in server-side. In this case I had pretty default config from navbar with search box http://getbootstrap.com/components/#navbar

It is defined like this:

So as you can see there is no controller and no ng-bind available, when you click the input "Search" is not removed from the input when you start typing.

I also tried to add "SearchCtrl" for the

and added $scope.query = ''; inside the controller and used ng-bind="query" for the input, but it didn't solve the issue.

I got same results with IE9 and IE8.

I also had another form in my page and there placeholder text was acting as it should, but form validation was broken -> form was dirty/empty at the begining.

-Markku Roponen

ps. Cannot confirm "refresh", but I can confirm that "Search" was stuck on that input and it didn't act correctly even when I added controller and binding.

On Mon, Aug 4, 2014 at 9:55 PM, cvn notifications@github.com wrote:

The way I'm reading the title, it seems like if you have a field like <input value="val" placeholder="place"> Then the placeholder will show place on first load, but val after a page refresh? @weshardee https://github.com/weshardee @RopoMen https://github.com/RopoMen Could either or both of you confirm this is the problem you're seeing?

I'm working on some other fixes that should also take care of this problem, but I want to be sure I know what's being reported here.

— Reply to this email directly or view it on GitHub https://github.com/jrief/angular-shims-placeholder/issues/10#issuecomment-51101738 .

jrief commented 10 years ago

Sorry for asking this, but is there anyone, whom I can transfer ownership for this project? Currently I have 6 OSS projects hosted on Github and I simply can not maintain all of them. Moreover, my current project has to be compatible down to IE10 only, so I don't even have a personal itch for it.

RopoMen commented 10 years ago

Hi, I don't have intrest atm to maintain this project, I needed this in one of our customers project, but I had to change to jquery.html5 shim version, because I cannot use time for this. I just hope that in some day I don't need to hear about IE 9 anymore =D

But ofc it would be nice to have pure Angular shim so you don't need to add some jq plugin to your project. Great work!

On Tue, Aug 5, 2014 at 9:30 PM, Jacob Rief notifications@github.com wrote:

Sorry for asking this, but is there anyone, whom I can transfer ownership for this project? Currently I have 6 OSS projects hosted on Github and I simply can not maintain all of them. Moreover, my current project has to be compatible down to IE10 only, so I don't even have a personal itch for it.

— Reply to this email directly or view it on GitHub https://github.com/jrief/angular-shims-placeholder/issues/10#issuecomment-51239485 .

cvn commented 10 years ago

I'm still not positive what the original bug was here, but the new version addresses some issues similar to this.

@weshardee @RopoMen If you could try 0.2.1 and see if it resolves your issues, I'd appreciate it.

@jrief I'll help with issues where I can.

RopoMen commented 10 years ago

Hi, It's been a long time when i worked on this, but I now made jsfiddle about this, I should have done this at the first place.

If you need you can downlowd Win7 + IE 9 virtualbox from here https://www.modern.ie/en-us

So,

  1. http://jsfiddle.net/RopoMen/u5L8d06h/8/ In this version ngModel is not optional and if you are using browser which doesn't support "placeholder" i.e. Internet Explorer 9, you will get error "Error: [$compile:ctreg] Controller 'ngModel', required by directive 'input', can't be found!"
  2. http://jsfiddle.net/RopoMen/u5L8d06h/9/ In this version ngModel is optional and placeholder text is showing up in IE9,(but there still was exception "TypeError: Unable to get value of the property '$setViewValue': objec...."). The biggest problem from the users point-of-view is that when you click the input element placeholder text doesn't go away (because there is no ngmodel).
  3. The final issue which I had with the form validation I was unable to re-produce it with JSfiddle, I'm not working on that project anymore so I cannot get more detailed informations about it, that stays mystery for now...
jrief commented 10 years ago

Just to add my two cents: Fortunately I am in the situation, not having to develop web apps for shitty legacy browsers any more. So I have no personal interest into this module anymore. If someone wants to overtake this module, he is welcomed.

cvn commented 10 years ago

@RopoMen Thanks for making those demos. I have some good news. Both the TypeError and the placeholder not disappearing issues were fixed in v0.2.1. Here is a fork of your demo that uses 0.2.1 http://jsfiddle.net/chad/c1xt9s6u/ It appears to be working without issue.

0.2.1 also has some fixes that would impact form validation, but it looks like it's too late for that project anyway.

I'm going to close this ticket for now. Thanks for all your feedback.

@jrief you can transfer ownership of the project to me.