473,511 Members | 14,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to validate a numeric value to check for a decimal place

4 New Member
Hi all,

i want to check whether a value entered into a specific html field is numeric as well as should contain one decimal value.( eg.23 is not accepted..It should be 23.0)
i have come up with a code which checks whether the value is numeric or not.

But how can i check for decimal place..Any one who can help me on this?

Thanks in Advance
Jul 5 '07 #1
3 2727
acoder
16,027 Recognized Expert Moderator MVP
You posted this in the Articles section. I have moved it over to the Forums section for you.
Jul 5 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
Hi all,

i want to check whether a value entered into a specific html field is numeric as well as should contain one decimal value.( eg.23 is not accepted..It should be 23.0)
i have come up with a code which checks whether the value is numeric or not.

But how can i check for decimal place..Any one who can help me on this?

Thanks in Advance
You can use regular expressions. See this link for a possible reg. exp. for a floating point number.

If you don't know how to use regular expressions, check out this link and how to use them in Javascript here.
Jul 5 '07 #3
kovik
1,044 Recognized Expert Top Contributor
You could also check it with a modulus of 1.
Jul 5 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1906
by: MrNobody | last post by:
I just noticed that a numeric up/down will let you manually type in any number even if it is beyond the min/max range you specified. The control will not actually return this value if it is...
2
3088
by: Kiran | last post by:
Hi, How can I check whether the value entered in a textbox is numeric without doing a postback Kiran
0
2403
by: rajmgopal | last post by:
Hello Everyone I am getting the following error when i try to insert a record into Sql Server 2005 from my VB 2005 application. sqlEx = {"Error converting data type numeric to numeric."} I...
11
2219
by: Pieter | last post by:
Hi, I'm having some troubles with my numeric-types in my VB.NET 2005 application, together with a SQL Server 2000. - I first used Single in my application, and Decimal in my database. But a...
10
3126
by: Matthew Wilson | last post by:
Lately, I've been writing functions like this: def f(a, b): assert a in assert b in The point is that I'm checking the type and the values of the parameters.
4
14913
by: =?Utf-8?B?UmljaA==?= | last post by:
Is there a way to determine if a numeric value contains a decimal? how to do this? If IsNumeric(txt1.Text) then ... so now I know that txt1.Text is a numeric value. How can I tell if it is a...
13
14947
by: nishit.gupta | last post by:
Is their any fuction available in C++ that can determine that a string contains a numeric value. The value cabn be in hex, int, float. i.e. "1256" , "123.566" , "0xffff" Thnx
2
6055
by: jobs | last post by:
I have a column that is numeric(18,2) in sql server. what type should I use in my sqldatasource parameter in asp.net? <asp:Parameter Name="CreditLimit" Type="Int32" /> what type should I use...
3
6568
by: kang jia | last post by:
hi, now i want to validate numeric value which user filled in in text box, it can have 2 decimal places. what is the regular expression i can use to achieve this? anyone can help? can reply me...
0
7137
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7349
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7417
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5659
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4734
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3210
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1572
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.