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