Code: -
<script language="javascript">
-
function setMaximumValue(txtObj, maxVal){
-
var tempVal = parseFloat('' + txtObj.value)
-
window.event.returnValue = (tempVal <= maxValue);
-
}
-
</script>
-
<form name="frmSample>
-
<input type="text" id="txtAmount" name="txtAmount" value=""
-
onkeypress="setMaximumValue(this, 100.00)">
-
</form>
Description:
Assume i will enter only numeric to text mox.
Here i want to set maximum value for the control txtAmount.
The maximum value can be numeric, decimal.
But here the keypress event is triggered, then typed character getting updated to "txtAmount" .
So what is the wright way to make this functionality.
3 8592 Code: -
<script language="javascript">
-
function setMaximumValue(txtObj, maxVal){
-
var tempVal = parseFloat('' + txtObj.value)
-
window.event.returnValue = (tempVal <= maxValue);
-
}
-
</script>
-
-
<form name="frmSample>
-
<input type="text" id="txtAmount" name="txtAmount" value=""
-
onkeypress="setMaximumValue(this, 100.00)">
-
</form>
Description:
Assume i will enter only numeric to text mox.
Here i want to set maximum value for the control txtAmount.
The maximum value can be numeric, decimal.
But here the keypress event is triggered, then typed character getting updated to "txtAmount" .
So what is the wright way to make this functionality.
Use Code Tags.
It's not working :-)
Kind regards,
Dmjpro.
pbmods 5,821
Recognized Expert Expert
Heya, getmeidea.
Please use CODE tags when posting source code:
[CODE=javascrip t]
JavaScript code goes here.
[/CODE]
Check this code, it is working fine.. - <script type="text/javascript">
-
function setMaximumValue(id,maxVal){
-
var txtObj=document.getElementById(id).value;
-
var tempVal = parseInt(txtObj);
-
if(tempVal>maxVal)
-
{
-
alert("Value cannot be taken");
-
document.getElementById(id).select();
-
document.getElementById(id).focus();
-
}
-
// window.event.returnValue = (tempVal <= maxVal);
-
}
-
</script>
-
<form name="frmSample">
-
<input type="text" id="txtAmount" name="txtAmount" value="" onkeyup="setMaximumValue(this.id,100.00)">
-
</form>
Moderator Note: hm, a bit late, I think
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: K. Davis |
last post by:
I need to increment the maximum value of a field of a table by 1 when a
form opens a blank record. (e.g.
=max(!![trip_number})
so the logic and references are working at the form level.
I've tried a number of variants tied to the before update event, but
always get the message "The field 'tripmain.trip_number' can't contain a
Null value because the Required property for this field is set to True.
Enter a value in this field."
|
by: Sunny123 |
last post by:
hello
i am trying to find the maximum value of a function and where it occur.
i.e there is an array
x |y
=============
|
|
|
by: garyusenet |
last post by:
I'm trying to investigate the maximum size of different variable types.
I'm using INT as my starting variable for exploration. I know that the
maximum number that the int variable can take is: 65,535. But i'm
trying to write a program to test this, assuming I didn't know this
number in advance. I came up with the following but have two questions.
Maybe someone can help?
using System;
using System.Collections.Generic;
using System.Text;
|
by: Madmartigan |
last post by:
Hello
I have the following task but am battling with the final output. How do I keep two different vectors in sync and how would I retrieve the index for the maximum value of one of the vectors?? (using Dev-C++ compiler)
Please see task and attempt below:
TASK : 1.8.1 Exercise 1A - Temperature tracker
Write a program that tracks temperatures during an experiment that takes 24 hours. The user should input the temperature. This...
|
by: Pugi! |
last post by:
hi,
I am using this code for checking wether a value (form input) is an
integer and wether it is smaller than a given maximum and greater then
a given minimum value:
function checkInteger(&$value, $checks) {
$err = '';
if (!is_numeric($value) || (floatval($value) != intval($value))) {
$err .= 'Input must be an integer. ';
| |
by: =?Utf-8?B?U2hhcm9u?= |
last post by:
I'm using the VScrollBar and set it as follow:
m_vScrollBar.Minimum = -19602;
m_vScrollBar.Maximum = 0;
m_vScrollBar.SmallChange = 1;
m_vScrollBar.LargeChange = 1089;
m_vScrollBar.Value = m_vScrollBar.Maximum;
The scroll bar is set to start from the bottom.
|
by: Manikandan |
last post by:
Hi,
I'm working with XML serialization.
I'm writing a xml file of huge size(above 500MB)
I need to show the user the progress of writing to file using progress
bar.
For this i need to create a thread and first start the thread and then
writing process, after writing to file stop the thread
My doubt is how to set the value for progress bar, some times file
size is 100MB and some other time 2GB like, I don't know how to set
the progress...
|
by: Fredrik Lundh |
last post by:
maurizio wrote:
What kind of file is it? Did you pick numpy because you want to do
matrix operations (beyond just finding a maximum value), or was it just
the first thing you stumbled upon when researching the problem?
A simple pattern for finding the maximum value in a file, using only
plain Python code, is:
|
by: maurizio |
last post by:
thank you for your answer
actually i've to do some statistics (maximum,minimum,mean,standard
deviation,....) of a file of data in which each column is a particular
type of data. (the file is a tab separated value).
I was trying to do this by using python (usually i work with fortran or
bash, but i'm learning python), that the reason why i tried to use numpy.
Fredrik Lundh wrote:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |