User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 402,657 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,197 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting

decimal (10,2) limit

Join Date: Mar 2008
Location: Madrid - Spain
Posts: 20
Reputation: HenryGR is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 3
HenryGR's Avatar
HenryGR HenryGR is offline Offline
Newbie Poster

Re: decimal (10,2) limit

  #4  
May 1st, 2008
From your message, I conclude that your problem is that Javascript does not understand that for you, "10,2" equals "10.2".
Here I wrote a sample html, but the important part is the javascript function that checks the value.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>No title</title>
<script type="text/javascript" language="javascript">
	function curcheck(curf,maxval) {
		
		textcur = curf.value.toString();
		
		textcur += '';
		x = textcur.split(',');
		textcur = x[0]+'.'+x[1];
		if(Number(textcur) > maxval) {
			say('result',false); 
			return 
		}
		say('result',true);
	}

function say(were,val) {

	text = ( val ) ? "Valid value entered" : "Invalid value entered" ;
	eval("document.getElementById('"+were+"').innerHTML = text");
	
}
</script>
</head>

<body>
<form id="myform" action="" >
	<input type="text" size="4" id="currency" onchange="curcheck(this,10.2);" />
	<p id="result">&nbsp;</p>
</form>
</body>
</html>

Hope this is what you need.
You keep going, have a Nice day!
Henry.

Before printing this message, make sure is necessary.
Reply With Quote  
All times are GMT -4. The time now is 3:25 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC