473,385 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Replicate textbox value

Hi.

I have a form with some textboxes in it. When a user clicks a button,
I need to verify if only one of the textboxes if filled and if so, I
need to replicate the value of this textbox to all other textboxes on
the form. If two or more textboxes are filled I don't need to do the
replication. How can I do that?

Thanks,

Robert Scheer
Jul 20 '05 #1
1 7576
Here is sample code to do that:

<html>
<head>
<script language="JavaScript" type="text/javascript">
<!--
function checkForm1(callerValue){
if (howManyFilled() == 1)
fillAll(callerValue)
}

function fillAll(value){
for (var i=0; i < document.forms['form1'].elements.length; i++){
document.forms['form1'].elements[i].value = value;
}
}

function howManyFilled(){
var howmany = 0;
for (var i=0; i < document.forms['form1'].elements.length; i++){
if (document.forms['form1'].elements[i].value == "")
continue
howmany++
}
return (howmany);
}
//-->
</script>
</head>

<body>
<form name="form1">
<input type="text" name="textbox1" onchange="checkForm1(this.value)"><br>
<input type="text" name="textbox2" onchange="checkForm1(this.value)"><br>
<input type="text" name="textbox3" onchange="checkForm1(this.value)"><br>
<input type="text" name="textbox4" onchange="checkForm1(this.value)"><br>
<input type="text" name="textbox5" onchange="checkForm1(this.value)"><br>
<input type="text" name="textbox6" onchange="checkForm1(this.value)"><br>
<input type="text" name="textbox7" onchange="checkForm1(this.value)"><br>
<input type="text" name="textbox8" onchange="checkForm1(this.value)"><br>
</form>
</body>
</html>

"Robert Scheer" <rb******@my-deja.com> wrote in message
news:cf**************************@posting.google.c om...
Hi.

I have a form with some textboxes in it. When a user clicks a button,
I need to verify if only one of the textboxes if filled and if so, I
need to replicate the value of this textbox to all other textboxes on
the form. If two or more textboxes are filled I don't need to do the
replication. How can I do that?

Thanks,

Robert Scheer

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Glynn Johnson | last post by:
I understand that there is no way to upload multiple files using ASP and COM+ without having multiple form elements like <input type='file'>. I also understand that there is no way to...
2
by: db2group88 | last post by:
we are using db2 udb v8.2 Express edition on windows 2003,we use third party vendor software to help replicate one server to another. Production server has three instances, each instances has one...
0
by: Paul Hobbs | last post by:
Hi All, I am trying to replicate the functionality of the HTML FileField control. I can use it just fine to prompt a user to browse to a file, and it retrieves the full path just fine. I can...
0
by: Paul Hobbs | last post by:
Hi All, I am trying to replicate the functionality of the HTML FileField control. I can use it just fine to prompt a user to browse to a file, and it retrieves the full path just fine. I can...
7
by: I am Sam | last post by:
I have a DataGrid that is passing information to a stored procedure properly but the parameters aren't being casted properly. I was woundering if anyone can tell me how I should properly cast the...
11
by: Keith | last post by:
I apologize for those of you who think I'm posting on the same topic. It is not that I don't appreciate all of your comments - and I'm definitely reading them all - but I think I have a differing...
6
by: Michael.Suarez | last post by:
Consider the TextBox Control. It has a KeyPress event of type KeyPressEventHandler which passes a KeyPressEventArgs to whatever method is assigned to the event. When you set e.Handled = false...
1
by: rakeshnair | last post by:
i wrote a code in jsp to create dynamic table..the problem is i need data base connection when cursor moves from one cell to other... eg...when i enter product id in the first cell, the product name...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...

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.