Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the typed number in original format with JS #746

Open
Echecivuole opened this issue Aug 2, 2022 · 3 comments
Open

Get the typed number in original format with JS #746

Echecivuole opened this issue Aug 2, 2022 · 3 comments
Labels
💁‍♂️ Need reporter feedback A response is needed from the reporter before being able to do more

Comments

@Echecivuole
Copy link

Hi @AlexandreBonneau ,

another small missing feature is that, yes we can pass the number not formatted on form submit, but we cannot get anyway the number typed in normal format!

Example:

€ 1.000,50 => get 1000.5

thanks

@AlexandreBonneau
Copy link
Member

Thanks for reporting this issue, however with the few information you gave us, we are not able to correctly reproduce it.
Could you please create a reproducible test case so we can fix your bug?

@AlexandreBonneau AlexandreBonneau added the 💁‍♂️ Need reporter feedback A response is needed from the reporter before being able to do more label Aug 2, 2022
@Echecivuole
Copy link
Author

Thanks for reporting this issue, however with the few information you gave us, we are not able to correctly reproduce it.
Could you please create a reproducible test case so we can fix your bug?

Hi @AlexandreBonneau , sorry here more details.
AutoNumeric is able to give a typed number as formatted with a currency.
Example: I type 1000.5 and it returns € 1.000,5 => OK

But I have already the € 1.000,5 into input like this:

<input type="text" class="form-control amount_format" name="amount" value="1.000,5">
And AutoNumeric loaded like this:

$(document).ready(function() { var autoNumericInstance = new AutoNumeric('.amount_format', { decimalCharacter: ',', decimalCharacterAlternative: '.', digitGroupSeparator: '.', unformatOnSubmit: true, }); });

Is there a way with AutoNumeric to get the rough value 1000.5 from the above input?

thanks

@AlexandreBonneau
Copy link
Member

I'm sorry I have a hard time understanding what is your problem/question.
And since you did not create a reproducible test case, it's hard to draw any conclusion.

I've tried creating one from your previous post, but again I'm not sure exactly what you are trying to achieve.
As you can see in the extensive documentation, there are many get*() functions available.

I've added those one so you can choose from them:

anElement.node().addEventListener("input", () => {
	console.log("anElement.getFormatted():", anElement.getFormatted());
	console.log("anElement.getNumber():", anElement.getNumber());
	console.log("anElement.getNumericString():", anElement.getNumericString());
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💁‍♂️ Need reporter feedback A response is needed from the reporter before being able to do more
Projects
None yet
Development

No branches or pull requests

2 participants