1

i have a problem with the tag <lightning:input type="number">. I want to insert max 3 integer and 3 decimal (999,999 or 1,0), i try to use this:

<lightning:input type="number" step="any" pattern="[0-9]{3},[0-9]{3}" min="0" aura:id="numberId" required="true" maxlength="6" label="numberLabel" name="numberName" />

but when i insert 1234,5678 the field show me 1.234,567 but if i click again on inputField the value is 1234,5678 (the lose onBlur cut the four decimal number, but when i click on field i see this (what value it will save? 1.234,567 or 1.234,5678?)). How i can insert max only 3 integer and 3 decimal without problem when i save? ps: maxlength doesn't work :/

Thanks in advance :)

1
  • I'm not able to reproduce your problem. With your code, I get "12,345,678" as displayed value. Even without the focus. – Martin Lezer Jun 9 '17 at 11:52
0

Try with this

<lightning:input type="number" step="any" pattern="[0-9]{3},[0-9]{3}" min="0" aura:id="numberId" required="true" maxlength="6" label="numberLabel" name="numberName" step="0.001"/>
-1

Basically, Step attribute in <lightning:input type="number"> tag enable decimal number entry, specify a value for step that represents the number of decimal places accepted and the increment.

For example, specifying step=".01" permits numbers such as 0.99 and 123456.78. The default stepping value for range inputs is 1,then a step of 1 will allow only values such as 1.5, 2.5, 3.5.

<lightning:input type="number" step="0.001" pattern="[0-9]{3},[0-9]{3}" min="0" aura:id="numberId" required="true" maxlength="6" label="numberLabel" name="numberName" />
1
  • Welcome to SFSE! Please take the tour and read How to Answer. It might just be too early and my brain isn't working yet, but I'm not seeing how this answers the question being asked. – Derek F Sep 11 '20 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.