Hi,
I hope this is the correct place for this post.
I have an asp page with a form.
The form has 2 text boxes for entering a serial number range.
first serial & last serial
In a variable on the asp page I have a quantity.
What I want is that when the user enters a serial number in the first
text box and presses the tab key to set focus to the second text box,
I want the second box to copy the first, but to increase by the qty in
my variable
i.e. Text Box 1:
User types: 1104555666 and presses tab
Qty in variable is 10
1104555666 should increase by 10 but include the first, i.e. -1 on the
end.
Text box 2 should then display 1104555675
How is this possible ?
Appreciate your help
David 4 2969
In article <c1************ **************@ posting.google. com>, david@scene-
double.co.uk enlightened us with... In a variable on the asp page I have a quantity. What I want is that when the user enters a serial number in the first text box and presses the tab key to set focus to the second text box, I want the second box to copy the first, but to increase by the qty in my variable
Okay, ASP runs on the server. Javascript runs on the client. So, the
important question is whether you expect that ASP variable to change based on
what the client entered. If so, use postback and do this with ASP.
If not, it's just mostly normal javascript with one little piece generated by
ASP.
i.e. Text Box 1: User types: 1104555666 and presses tab
Qty in variable is 10
Okay, the variable is only 10 when the doc is still on the server. I'll call
the variable myVariable for both server-side and client-side and assume it is
NOT a string (i.e. is integer, float, etc)...
<script type="text/javascript">
var myVariable = <%= myVariable %>;
</script>
Now you can access the variable through myVariable on the client. You can
change the value of the javascript variable as needed.
But, as I said, if you expect the ASP var to change, sorry, it can't be done
on the client. The server has already finished with it.
Using postback sends form data back to the server for another round of
processing without wiping out the form values. I believe it is only available
in .NET, not ASP classic.
--
--
~kaeli~
"When dogma enters the brain, all intellectual activity ceases"
-- Robert Anton Wilson http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace
David wrote:
[...] How is this possible ?
Client JS should be something like:
<script type="text/javascript">
// I've made theRange as a global, but could be
// local inside the function
var theRange = 10;
function doCalc(x,y){
y.value = 1*x.value + 1*theRange - 1;
}
</script>
<form action="">
<input type="text" width="100px" name="in1" id="in1"
onblur="doCalc( this,this.form. qty)">
<input type="text" width="20px" name="qty" id="qty">
</form>
Just set the value of "theRange" from the server, or allow the user to
modify it in the page.
Rob.
kaeli <ti******@NOSPA M.comcast.net> wrote in message news:<MP******* *************** **@nntp.lucent. com>... In article <c1************ **************@ posting.google. com>, david@scene- double.co.uk enlightened us with... In a variable on the asp page I have a quantity. What I want is that when the user enters a serial number in the first text box and presses the tab key to set focus to the second text box, I want the second box to copy the first, but to increase by the qty in my variable
Okay, ASP runs on the server. Javascript runs on the client. So, the important question is whether you expect that ASP variable to change based on what the client entered. If so, use postback and do this with ASP. If not, it's just mostly normal javascript with one little piece generated by ASP.
i.e. Text Box 1: User types: 1104555666 and presses tab
Qty in variable is 10
Okay, the variable is only 10 when the doc is still on the server. I'll call the variable myVariable for both server-side and client-side and assume it is NOT a string (i.e. is integer, float, etc)... <script type="text/javascript"> var myVariable = <%= myVariable %>; </script>
Now you can access the variable through myVariable on the client. You can change the value of the javascript variable as needed.
But, as I said, if you expect the ASP var to change, sorry, it can't be done on the client. The server has already finished with it. Using postback sends form data back to the server for another round of processing without wiping out the form values. I believe it is only available in .NET, not ASP classic.
--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>untitled </title>
<script type="text/javascript">
/*
* asp: var qty = <%= qty %>;
*/
var qty = 10; //output
function fieldchk(obj)
{
var v = obj.value;
if (/\D/g.test(v))
{
alert('The first serial number must consist of digits only.');
obj.value = '';
setTimeout(func tion(){obj.focu s();}, 50);
return;
}
else obj.form.elemen ts.lastserial.v alue = v - 1 + qty;
}
</script>
</head>
<body>
<form style="width:22 0px;">
first serial number » <input type="text" name="firstseri al" value=""
size="10" onchange="field chk(this)" />
last serial number » <input type="text" name="lastseria l" value=""
size="10" readonly="reado nly" style="border:n one;" />
</form>
</body>
</html>
Thanks Rob,
Works brilliantly !!
I have only one issue.
Sometimes my users need to enter a 0 (Zero) in text box 1 if there are
no serial numbers for this particular item.
If the user enters a 0, how can I adapt the code to copy only a 0 to
textbox 2 if a 0 is entered in text box 1.
Otherwise the function should work as you wrote.
Appreciate your thoughts.
David
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Khue Pham |
last post by:
Does anyone knows how to copy database from one server to another. By
copying I mean literally everything, not just the database. I know we
can dump the database from one server then reload it to another one.
However, I have a specific need for this and here is my problem:
I have my development server as of RedHat 9.0 and I install the
combination of LAMPS (Linux+Apache+MySQL+PHP+SSL). I configure it
works perfectly on my development...
|
by: Anna |
last post by:
Hi all.
I am trying to write a stylesheet that will structure the input HTML
file in the following way:
For each heading of level n it needs to enclose the heading and all
its content until the next heading of the same level within the level
tag.
Example
input file:
|
by: Tess |
last post by:
Hi,
Long time reader, first time poster... Any help is appreciated.
I have a few questions regarding Winform controls embedded within an
html page. For more info please see the appendix. Now, for the
questions.
1. A button on my control executes the
System.IO.Directory.GetDirectories funtion (the scanned directory
resides on the hosting web server). What credentials is this
|
by: Rachel Suddeth |
last post by:
This may not be the right forum, but it's a problem I chiefly come across
when trying to post here.
When I do a copy/paste from VS, the text always looks really weird (and even
if I'm in an editor that's supposed to be doing plain text, it looks like
it's in a different font -- and of course you can't change the font in a
plain text editor.) Then when it gets converted to actual plain text, there
is a blank line stuck in between every...
|
by: lgbjr |
last post by:
Hello All,
I¡¯m using a context menu associated with some pictureboxes to provide
copy/paste functionality. Copying the image to the clipboard was easy. But
pasting an image from the clipboard is proving to be more difficult. These
pictureboxes are bound to an AccessDB. If the user wants to add an image,
they select an image using an OpenFileDialog:
Dim result As DialogResult = Pic_Sel.ShowDialog()
If (result = DialogResult.OK) Then
| |
by: igendreau |
last post by:
I have a database with a Header table. Each record in tblHeader has
two One-to-Many Relationships: with tblLines and tblKeys. The HeaderID
field ties tblHeader to the other two tables. The data collected in
tblHeader is simple: HeaderID (unique), a text description field, and a
date field.
I need to be able to copy header and it's related info.
I have a form with a "Copy Source" combo box allowing the user to
select a Header...
|
by: Richnep |
last post by:
Hi all,
I have tabbed subforms where I need to copy one field value from one
subform over to another subform. Although I can run an update query to
accomplish this I would like to do it through VBA.
sub tables relationships are 1:N with the main table.
So the recods display like this in the subform:
|
by: usman |
last post by:
Hi
I have a windows service that backups a folder onto another location on the
same computer. The service is written in C#. The size of the original folder
is large i.e. over 8 GB. Also the folder structure is very deep, i.e lot of
recursion. What happens is that the backup process terminates after sometime
taking backup of around 2 GB. If I debug the same code I dont get any error,
instead the whole folder is copied successfully. Is...
|
by: carlton129 |
last post by:
Hi!
I am trying to copy the current form and subform to the clipboard with the click of a button so that I can paste it in another application. So far, I can get all of the Form info together into a memo using the setvalue feature in a macro. Then, I setfocus to that memo field and run the copy command. I get it all except for the info in the subfom. I try to reference the subform but I get an "automation error". Also, How do I force a...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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: 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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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.
| |