ui-mask icon indicating copy to clipboard operation
ui-mask copied to clipboard

When initializing the mask it is set to dirty

Open marbletravis opened this issue 11 years ago • 6 comments

When initializing the mask it is set to dirty even though technically the data hasn't changed.

In initPlaceHolder function eventHandler is called which ends up setting the field as dirty. It appears in other initialization sequences that we don't want it set to dirty.

Bug?

marbletravis avatar Aug 10 '15 17:08 marbletravis

I'm also seeing this issue in v1.4.2. It seems to happen in IE11 only. Chrome 44 and Firefox 29 do not set the $dirty flag.

meyerds avatar Aug 14 '15 21:08 meyerds

@meyerds I am not seeing the issue with v1.4.2 in IE 11 specifically version below. image

I wouldn't mind helping you figure this out. Can you provide more information, Just to clarify $dirty should be set when a user edits the field, but not when the field is being initialized.

Your code isn't by chance open source (and hosted on Git Hub) by chance? So I can take a look.

marbletravis avatar Aug 19 '15 15:08 marbletravis

+1

fabioginzel avatar Aug 20 '15 01:08 fabioginzel

There was an issue in IE where a placeholder input would fire the 'input' event initially, dirtying the form. It makes UI-mask look like the culprit, but I believe IE is to blame. The angular team fixed this in angular 1.3.6.

conner-fallone avatar Aug 25 '15 13:08 conner-fallone

Using ui.mask 1.6.7 and Angular 1.4.4 I'm still seeing this issue in IE11 on an input with a phone number mask. The input event is still firing with the oldValue as '(_)-___', it enters the "User attempted to delete but raw value was unaffected" block and sets valAltered = true. I think this could be handled easily just by checking if the new valUnmasked is any different from valUnmaskedOld and not setting valAltered if they are still the same, since the value has not, in fact, been altered.

I don't think the angular fix handles all scenarios, as they still have an open item: https://github.com/angular/angular.js/issues/7726, which links to a Microsoft bug that is marked fixed in Edge (but not IE10,11,etc.).

Will you consider reopening this issue? I'd be happy to submit a pull request with the fix.

MikeMatusz avatar Jan 19 '16 20:01 MikeMatusz

Hi, I am getting same Issue with Angular2/4, can anyone help me with it?

Vaaceph avatar Jul 05 '17 07:07 Vaaceph