question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get raw value of field using number mask

See original GitHub issue

Hello,

I have the following issue: I am using text fields with number mask, of following way: mask='9'. But I want to consider invalid the empty fields. But when the validator is accessing the masked empty field, the value attribute is 0.

I do not want to consider empty values a zero. I want to consider empty values as invalid. I have tried to put the Validators.required validator before the custom validator, but the empty field pass.

Any way to accessing the raw field value? I need this.

Regards,

Luis

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kluevandrewcommented, Dec 4, 2020

The same problem still affects me, there is the only one way, change the library

1reaction
bryanmartinez01commented, Mar 14, 2019

@Thegrep01 I think I found the problem. The ngx-mask is working fine when the initial value is empty. But when the initial value of the model is a number, emptying the text input will set the value of the model to 0 not empty.

sampleModel = null; the value of the sampleModel after emptying the text input will be empty

sampleModel = 1; //or any number the value of the sampleModel after emptying the text input will be 0

Read more comments on GitHub >

github_iconTop Results From Across the Web

InputMask Raw Values | Input | JavaScript Wijmo Demos
The InputMask's value property returns the full text content of the control, including the user's input and any template characters. Use the rawValue...
Read more >
How to get the raw value of an antd form field using antd-mask ...
Here is an working example on codesandbox.io. Fill in any value on both fields and open console. Once you click on Confirm the...
Read more >
Solved: How to mask a field value from raw events that sho...
I'm trying to mask a field value for a policy number that is present in my raw logs under different patterns. To explain...
Read more >
Input Mask Guide | imaskjs
Instance of InputMask is returned when IMask constructor is called. To create new mask on element use: var mask = IMask(element, maskOptions);. Get/set...
Read more >
Input Masking | CSS-Tricks
... when inputs that expect data in a specific format use an input mask. ... and the bundled plugin is 180 KB (raw),...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found