Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,

I want to check input type number onkeypress max length should be 10 including two decimal number only. How can I do?

Example: 1234567891.67

What I have tried:

JavaScript
function getInteger(int) {    
   // var regx = /^[0-9]+(\.[0-9]{1,2})?$/; 
    var regx = /^\d{10}$/;    
    if (!regx.test(int)) {       
        int.preventDefault();
        return false;
    }
}


Above code is not working for me.

Thanks
Posted
Updated 4-Jul-23 19:01pm
v2
Comments
Graeme_Grant 5-Jul-23 1:05am    
You changed the question from a Razden component to generic Javascript. Is this still for a Razden component? Did you try their support forum? They may have a solution that does not require any javascript.
Rajesh Kumar 2013 5-Jul-23 1:16am    
I think javascript also work on Razden component. So I am finding that way.
Graeme_Grant 5-Jul-23 2:53am    
Did you ask in their help forum?
Rajesh Kumar 2013 5-Jul-23 3:52am    
yes. I already done. https://forum.radzen.com/t/max-ignored-for-radzennumeric/14635
Graeme_Grant 5-Jul-23 3:54am    
The code for their control is public domain in a github repo. you could fork the repo and add a new param to their control to meet your needs.

Alternatively, you set the max value to 9999999999.99 which is a max of 10 digits + 2 decimals.

1 solution

I don't think that the Razden Numeric control[^] works that way. Here is the API: Class RadzenNumeric<TValue>[^]

You can ask here: https://blazor.radzen.com/support[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900